MediaYouTubeStyles.inc 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * @file
  4. * Styles class implementation for Media: YouTube.
  5. */
  6. class MediaYouTubeStyles extends FileStyles {
  7. public $autoplay;
  8. public $fullscreen;
  9. function getAutoplay() {
  10. return $this->get('autoplay');
  11. }
  12. function setAutoplay($value) {
  13. return $this->set('autoplay', $value);
  14. }
  15. function getFullscreen() {
  16. return $this->get('fullscreen');
  17. }
  18. function setFullscreen($value) {
  19. return $this->set('fullscreen', $value);
  20. }
  21. function getImageUri() {
  22. if ($image_uri = $this->get('imageUri')) {
  23. return $image_uri;
  24. }
  25. $object = $this->getObject();
  26. if ($object->uri) {
  27. $wrapper = file_stream_wrapper_get_instance_by_uri($object->uri);
  28. return $wrapper->getLocalThumbnailPath();
  29. }
  30. }
  31. function video($effect) {
  32. $variables = array(
  33. 'uri' => $this->getUri(),
  34. 'width' => $this->getWidth(),
  35. 'height' => $this->getHeight(),
  36. 'autoplay' => $this->getAutoplay(),
  37. 'fullscreen' => $this->getFullscreen(),
  38. );
  39. $this->setOutput(theme('media_youtube_video', $variables));
  40. }
  41. }