You are here

function theme_lightbox2_emvideo in Lightbox2 6

Generate the HTML output to open embedded cck videos in a lightbox.

Parameters

$field: The CCK field the action is being performed on.

$item: An array, keyed by column, of the data stored for this item in this field.

$formatter: The formatter to use for the field.

$node: The node object.

$options: Options array.

Return value

Themed link to the embedded media field video.

File

./lightbox2.formatter.inc, line 519
Lightbox2 formatter hooks and callbacks.

Code

function theme_lightbox2_emvideo($field, $item, $formatter, $node, $options = array()) {
  $thumbnail = isset($options['thumbnail']) ? $options['thumbnail'] : theme('emvideo_video_thumbnail', $field, $item, 'video_thumbnail', $node, TRUE, $options);

  // if options title set use that, otherwise use video title if set in node,
  // otherwise try node title, then widget thumbnail setting and fallback to
  // default string.
  $title = isset($options['title']) ? $options['title'] : (isset($item['data']['emthumb']['emthumb_title']) ? $item['data']['emthumb']['emthumb_title'] : (isset($node->title) ? $node->title : (isset($field['widget']['thumbnail_link_title']) ? $field['widget']['thumbnail_link_title'] : variable_get('emvideo_default_thumbnail_link_title', t('See video')))));
  $destination = 'video-cck/lightbox2/' . $node->nid . '/' . $field['widget']['video_width'] . '/' . $field['widget']['video_height'] . '/' . $field['field_name'] . '/' . $item['provider'] . '/' . $item['value'];
  $width = $field['widget']['video_width'] + 20;
  $height = $field['widget']['video_height'] + 20;
  if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) {
    $width = $field['widget']['video_width'] + 40;
    $height = $field['widget']['video_height'] + 40;
  }
  $rel_full = 'lightframe[' . $field['type_name'] . '|width:' . $width . 'px; height:' . $height . 'px; overflow:visible;]';
  $attributes = array(
    'attributes' => array(
      'title' => $title,
      'class' => $field['type_name'],
      'rel' => $rel_full,
    ),
    'query' => NULL,
    'fragment' => NULL,
    'absolute' => FALSE,
    'html' => TRUE,
  );
  $output = l($thumbnail, $destination, $attributes);
  return $output;
}