You are here

function theme_brightcove_field_entity_link in Brightcove Video Connect 7.2

Theme callback for Default thumbnail linked to entity formatter.

1 string reference to 'theme_brightcove_field_entity_link'
brightcove_field_theme in brightcove_field/brightcove_field.module
Implementation of hook_theme().

File

brightcove_field/brightcove_field.formatters.inc, line 166
Formatters for video field.

Code

function theme_brightcove_field_entity_link($variables) {
  $video_id = isset($variables['element']['video_id']) ? $variables['element']['video_id'] : NULL;
  $formatter_name = $variables['display']['type'];
  $entity_info = entity_get_info($variables['entity_type']);
  $entity = $variables['entity'];
  if (!empty($video_id)) {
    $field = str_replace('entity_link_', '', $formatter_name);
    $video = brightcove_video_load($video_id);
    $image = $variables['image'] ? $variables['image'] : theme('image', empty($video->{$field}) ? array(
      'path' => brightcove_get_default_image(),
      'width' => 120,
      'height' => 120,
    ) : array(
      'path' => $video->{$field},
    ));

    // TODO make some checks here
    $uri = $entity_info['uri callback']($entity);
    $destination = $uri['path'];
    $output = l($image, $destination, array(
      'attributes' => array(
        'class' => array(
          $variables['field']['field_name'],
        ),
      ),
      'html' => TRUE,
    ));
    return theme('brightcove_field_entity_link', array(
      'output' => $output,
    ));
  }
  return '';
}