From d51725f6edf57b170a9bb38bf609f93e9eba08d4 Mon Sep 17 00:00:00 2001 From: Heshan Wanigasooriya Date: Fri, 4 Feb 2011 06:50:28 +0000 Subject: Adding formatter update for the default thumbnails check and display settings --- includes/video_helper.inc | 5 +++-- video_formatter.inc | 37 +++++-------------------------------- 2 files changed, 8 insertions(+), 34 deletions(-) diff --git a/includes/video_helper.inc b/includes/video_helper.inc index 54d1ed8..e031f39 100644 --- a/includes/video_helper.inc +++ b/includes/video_helper.inc @@ -51,7 +51,7 @@ class video_helper { // load thumbnail object $video->thumbnail = $this->thumbnail_object($variables); // $video->formatter = $variables['#formatter']; - $video->autoplay = variable_get('video_autoplay', TRUE); + $video->autoplay = variable_get('video_autoplay', FALSE); $video->autobuffering = variable_get('video_autobuffering', TRUE); $video->theora_player = variable_get('video_ogg_player', 'http://theora.org/cortado.jar'); // lets find out if we have transcoded this file and update our paths. @@ -103,7 +103,8 @@ class video_helper { $thumbnail->filepath = $thumbnail_load->uri; } else { //need some type of default if nothing is present - //drupal_set_message(t('No thumbnail has been configured for the video.'), 'error'); + drupal_set_message(t('No thumbnail has been configured for the video !title.', array('!title' => $variables['entity']->title)), 'error'); + return; } $thumbnail->url = file_create_url($thumbnail->filepath); diff --git a/video_formatter.inc b/video_formatter.inc index dead10e..bb45291 100644 --- a/video_formatter.inc +++ b/video_formatter.inc @@ -42,6 +42,11 @@ function theme_video_thumbnail($variables) { $video_helper = new video_helper; // @TODO : change the object to an array $thumbnail = (array) $video_helper->thumbnail_object($variables); + // return if no file path found for the video thumbnails and add log message + if (empty($thumbnail['filepath'])) { + watchdog('video', 'Unable to find the video thumbnail for the %node.', array('%node' => $variables['entity']->title), WATCHDOG_ERROR); + return ''; + } $image = array( 'path' => $thumbnail['filepath'], 'alt' => $thumbnail['alt'], @@ -201,38 +206,6 @@ function theme_video_flv($video, $node) { return theme('video_play_flv', $video, $node, $themed_output); } -function theme_video_formatter_imagecache($variables) { - // Inside a view $variables may contain NULL data. In that case, just return. - if (empty($variables['#item']['fid'])) { - return ''; - } - - // Extract the preset name from the formatter name. - list($namespace, $theme_function) = explode('__', $variables['#formatter'], 2); - if ($preset = imagecache_preset_by_name($namespace)) { - $variables['imagecache_preset'] = $namespace; - } - //return $theme_function; - return theme('video_formatter_' . $theme_function, $variables, TRUE); -} - -/** - * Returns HTML for an image field formatter. - * - * @param $variables - * An associative array containing: - * - item: An array of image data. - * - video_style: An optional vieo thumb style. - * - path: An array containing the link 'path' and link 'options'. - * - field : field settings - * - instance : field instance settings - * - * @ingroup themeable - */ -function theme_video_formatter($variables) { - return video_get_player($variables); -} - /** * Process variables for video-play-quicktime.tpl.php. * -- cgit v1.2.3