You are here

function emvideo_modal in Embedded Media Field 6.2

Same name and namespace in other branches
  1. 6.3 contrib/emvideo/emvideo.module \emvideo_modal()
  2. 6 contrib/emvideo/emvideo.module \emvideo_modal()

Page callback for emvideo/thickbox/shadowbox. This will display our video in a modal window defined by the corresponding modal module. As it's a direct callback, it displays no HTML other than the video.

Parameters

$node: The video node object. @param $width The width, in pixels, of the video. @param $height The height, in pixels, of the video. @param $field_name The name of the field to display @param $provider The provider of the video. @param $code The video code to display. @param $extra Some video codes have a '/' character, so we have to accomodate in the URL.

1 string reference to 'emvideo_modal'
emvideo_menu in contrib/emvideo/emvideo.module
Implementation of hook_menu().

File

contrib/emvideo/emvideo.module, line 685
Embedded Video module is a handler for 3rd party video files.

Code

function emvideo_modal($node, $width, $height, $field_name, $provider, $code, $extra = NULL) {
  $field = content_fields($field_name);
  $field['widget']['video_width'] = (int) $width;
  $field['widget']['video_height'] = (int) $height;
  $field['widget']['video_autoplay'] = 1;

  // Respect any field access permissions.
  if (!content_access('view', $field, NULL, $node)) {
    drupal_access_denied();
    return;
  }

  // If the URL has an extra bit, then append that to the video code.
  // This broke shadowbox, which needs index.php to register as iFrame.
  if (isset($extra) && $extra != 'index.php') {
    $code .= '/' . $extra;
  }
  foreach ($node->{$field_name} as $video) {
    if ($video['provider'] == $provider && $video['value'] == $code) {
      $item = $video;
    }
  }

  // Suppress the Admin Menu, if that module/fuction exists.
  if (function_exists('admin_menu_suppress')) {
    admin_menu_suppress();
  }
  $output = theme('emvideo_video_video', $field, $item, 'video_video', $node, array(
    'iframe' => TRUE,
  ));
  print theme('emvideo_modal_iframe', $output);
}