You are here

function theme_emvideo_modal_generic in Embedded Media Field 6.3

Same name and namespace in other branches
  1. 6 contrib/emvideo/emvideo.theme.inc \theme_emvideo_modal_generic()
  2. 6.2 contrib/emvideo/emvideo.theme.inc \theme_emvideo_modal_generic()
5 theme calls to theme_emvideo_modal_generic()
theme_emvideo_lightbox2 in contrib/emvideo/emvideo.theme.inc
Display the video as a Lightbox2 modal popup. Requires the Lightbox2 module.
theme_emvideo_shadowbox in contrib/emvideo/emvideo.theme.inc
Display the video as a Shadowbox modal popup. Requires the Shadowbox module.
theme_emvideo_thickbox in contrib/emvideo/emvideo.theme.inc
Display the video as a Thickbox modal popup. Requires the Thickbox module.
theme_emvideo_video_replace in contrib/emvideo/emvideo.theme.inc
theme_emvideo_video_replace_preview in contrib/emvideo/emvideo.theme.inc

File

contrib/emvideo/emvideo.theme.inc, line 218
This defines the various theme functions for Embedded Video Field (emvideo).

Code

function theme_emvideo_modal_generic($field, $item, $formatter, $node, $options = array()) {
  $title = isset($options['title']) ? $options['title'] : (isset($node->title) ? $node->title : (isset($node->node_title) ? $node->node_title : (isset($field['widget']['thumbnail_link_title']) ? $field['widget']['thumbnail_link_title'] : variable_get('emvideo_default_thumbnail_link_title', t('See video')))));
  $thumbnail = isset($options['thumbnail']) ? $options['thumbnail'] : theme('emvideo_video_thumbnail', $field, $item, 'video_thumbnail', $node, TRUE, $options);
  $width = $formatter == 'video_replace_preview' ? $field['widget']['preview_width'] : $field['widget']['video_width'];
  $height = $formatter == 'video_replace_preview' ? $field['widget']['preview_height'] : $field['widget']['video_height'];
  $destination = 'emvideo/modal/' . $node->nid . '/' . $width . '/' . $height . '/' . $field['field_name'] . '/' . $item['provider'] . '/' . $item['value'];
  $link_class = 'emvideo-thumbnail-replacement emvideo-modal-' . $options['modal'] . ' ' . $options['modal'];
  $attributes = array(
    'attributes' => array(
      'title' => $title,
      'class' => $link_class,
    ),
    'query' => NULL,
    'fragment' => NULL,
    'absolute' => FALSE,
    'html' => TRUE,
  );
  if ($options['modal'] == 'lightbox2') {
    $attributes['attributes']['rel'] = 'lightframe[' . $field['type_name'] . '|width:' . ($width + 16) . '; height:' . ($height + 16) . ';]';
  }
  else {
    if ($options['modal'] == 'shadowbox') {
      $attributes['attributes']['rel'] = 'shadowbox[' . $field['type_name'] . '];width=' . ($width + 5) . ';height=' . ($height + 5);

      // Shadowbox needs a .php extension so it knows to open as an iFrame.
      $destination .= '/index.php';
    }
  }
  if ($options['modal'] == 'lightbox2' && function_exists('lightbox2_add_files')) {
    lightbox2_add_files();
  }
  static $added_js;
  if (!isset($added_js)) {

    // Add the play button image overlay.
    drupal_add_js(array(
      'emvideo' => array(
        'thumbnail_overlay' => variable_get('emfield_thumbnail_overlay', TRUE),
      ),
    ), 'setting');
    drupal_add_js(drupal_get_path('module', 'emvideo') . '/emvideo.thumbnail-replacement.js');
    drupal_add_css(drupal_get_path('module', 'emvideo') . '/emvideo.thumbnail-replacement.css');
    $added_js = TRUE;
  }
  $class = 'emvideo-modal emvideo-' . $options['modal'];
  if ($options['wrapper-class']) {
    $class .= ' ' . $options['wrapper-class'];
  }
  $output = '<div class="' . $class . '">' . l($thumbnail, $destination, $attributes) . '</div>';
  return $output;
}