You are here

function brightcove_media_file_formatter_image_view in Brightcove Video Connect 7.4

Same name and namespace in other branches
  1. 7.7 brightcove_media/brightcove_media.module \brightcove_media_file_formatter_image_view()
  2. 7.2 brightcove_media/brightcove_media.module \brightcove_media_file_formatter_image_view()
  3. 7.3 brightcove_media/brightcove_media.module \brightcove_media_file_formatter_image_view()
  4. 7.6 brightcove_media/brightcove_media.module \brightcove_media_file_formatter_image_view()

The brightcove_media_image file formatter view callback.

Parameters

$file:

$display:

$langcode:

Return value

array|null

1 string reference to 'brightcove_media_file_formatter_image_view'
brightcove_media_file_formatter_info in brightcove_media/brightcove_media.module
Implements hook_file_formatter_info().

File

brightcove_media/brightcove_media.module, line 231
This module provide the hook implementations for the integration with Media module.

Code

function brightcove_media_file_formatter_image_view($file, $display, $langcode) {
  $scheme = file_uri_scheme($file->uri);
  if ($scheme == 'brightcove' || $scheme == 'brightcove-playlist') {
    $video = NULL;
    $id = parse_url($file->uri, PHP_URL_HOST);
    if ($scheme == 'brightcove') {
      $video = brightcove_video_load($id);
    }
    elseif ($scheme == 'brightcove-playlist') {
      $video = brightcove_playlist_load($id);
    }
    $element = array(
      '#theme' => 'brightcove_media_image',
      '#video' => $video,
    );
    return $element;
  }
  return NULL;
}