123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- <?php
- /**
- * @file media_archive/includes/media_archive.styles.inc
- * Styles definitions for Media: Archive.
- */
- /**
- * Implementation of Styles module hook_styles_default_containers().
- */
- function media_archive_styles_default_containers() {
- // We append Archive to the file containers.
- return array(
- 'file' => array(
- 'containers' => array(
- 'media_archive' => array(
- 'class' => 'MediaArchiveStyles',
- 'name' => 'media_archive',
- 'label' => t('Archive'),
- 'preview' => 'media_archive_preview_style',
- ),
- ),
- ),
- );
- }
- /**
- * Implementation of Styles module hook_styles_default_presets().
- */
- function media_archive_styles_default_presets() {
- return array(
- 'file' => array(
- 'containers' => array(
- 'media_archive' => array(
- 'default preset' => 'linked_thumbnail',
- 'styles' => array(
- 'original' => array(
- 'default preset' => 'video',
- ),
- 'thumbnail' => array(
- 'default preset' => 'linked_thumbnail',
- ),
- 'square_thumbnail' => array(
- 'default preset' => 'linked_square_thumbnail',
- ),
- 'medium' => array(
- 'default preset' => 'linked_medium',
- ),
- 'large' => array(
- 'default preset' => 'large_video',
- ),
- ),
- 'presets' => array(
- 'unlinked_thumbnail' => array(
- array(
- 'name' => 'thumbnail',
- 'settings' => array(),
- ),
- ),
- 'linked_thumbnail' => array(
- array(
- 'name' => 'link_to_media',
- 'settings' => array(),
- ),
- array(
- 'name' => 'thumbnail',
- 'settings' => array(),
- ),
- ),
- 'linked_square_thumbnail' => array(
- array(
- 'name' => 'link_to_media',
- 'settings' => array(),
- ),
- array(
- 'name' => 'image_style',
- 'settings' => array(
- 'image_style' => 'square_thumbnail',
- ),
- ),
- array(
- 'name' => 'thumbnail',
- 'settings' => array(),
- ),
- ),
- 'linked_medium' => array(
- array(
- 'name' => 'link_to_media',
- 'settings' => array(),
- ),
- array(
- 'name' => 'image_style',
- 'settings' => array(
- 'image_style' => 'medium',
- ),
- ),
- array(
- 'name' => 'thumbnail',
- 'settings' => array(),
- ),
- ),
- 'video' => array(
- array(
- 'name' => 'video',
- 'settings' => array(),
- ),
- ),
- 'large_video' => array(
- array(
- 'name' => 'resize',
- 'settings' => array(
- 'width' => 480,
- 'height' => 360,
- ),
- ),
- array(
- 'name' => 'video',
- 'settings' => array(),
- ),
- ),
- ),
- ),
- ),
- ),
- );
- }
- class MediaArchiveStyles extends FileStyles {
- public $autoplay;
- public $fullscreen;
- function get_autoplay() {
- return $this->get('autoplay');
- }
- function set_autoplay($value) {
- return $this->set('autoplay', $value);
- }
- function get_fullscreen() {
- return $this->get('fullscreen');
- }
- function set_fullscreen($value) {
- return $this->set('fullscreen', $value);
- }
- function get_image_uri() {
- if ($image_uri = $this->get('image_uri')) {
- return $image_uri;
- }
- $object = $this->get_object();
- if ($object->uri) {
- $wrapper = file_stream_wrapper_get_instance_by_uri($object->uri);
- return $wrapper->getLocalThumbnailPath();
- }
- }
- function video($effect) {
- $variables = array(
- 'uri' => $this->get_uri(),
- 'width' => $this->get_width(),
- 'height' => $this->get_height(),
- 'autoplay' => $this->get_autoplay(),
- 'fullscreen' => $this->get_fullscreen(),
- );
- $this->set_output(theme('media_archive_video', $variables));
- }
- }
|