You are here

function theme_brightcove_cck_node_link in Brightcove Video Connect 6.2

Same name and namespace in other branches
  1. 6 brightcove_cck/brightcove_cck.formatters.inc \theme_brightcove_cck_node_link()

Theme callback for Default thumbnail linked to node formatter.

Parameters

$element: Element with the Video ID.

Return value

Link HTML code.

1 string reference to 'theme_brightcove_cck_node_link'
brightcove_cck_theme in brightcove_cck/brightcove_cck.module
Implementation of hook_theme().

File

brightcove_cck/brightcove_cck.formatters.inc, line 166
Formatters for video CCK field.

Code

function theme_brightcove_cck_node_link($element, $image = NULL) {
  if (!empty($element['#item']['video_id'])) {
    $field = str_replace('node_link_', '', $element['#formatter']);
    $video = brightcove_video_load($element['#item']['video_id']);

    /* Temporary turned off, because getting of status in BC API throws error for users without write api key
       $status = brightcove_status($element['#item']['video_id']);
       if ($status != BRIGHTCOVE_STATUS_COMPLETE && ($message = brightcove_expose_unavailable($status))) {
         return $message;
       } else if ($status != BRIGHTCOVE_STATUS_COMPLETE) {
         return FALSE;
       }*/
    if (!$image) {
      if (!empty($video->{$field})) {
        $image = theme('image', $video->{$field}, '', '', NULL, FALSE);
      }
      else {
        $image = theme('image', brightcove_get_default_image(), $video_name, $video_name, array(
          'width' => 120,
          'height' => 120,
        ), FALSE);
      }
    }
    $destination = 'node/' . $element['#node']->nid;
    $output = l($image, $destination, array(
      'attributes' => array(
        'class' => $element['#field_name'],
        'title' => check_plain($element['#node']->name),
      ),
      'html' => TRUE,
    ));
    $video_id = $element['#item']['video_id'];
  }
  if ($output) {
    return theme('brightcove_cck_node_link', $output, $video_id, url($destination), $field, $element['#field_name'], $element['#type_name'], $preset);
  }
}