You are here

function lightbox2_video_cck in Lightbox2 5.2

Configures settings and outputs the video.

Parameters

node: The node object.

width: The lightbox video width.

height: The lightbox video height.

field_name: The name of the cck field the video is contained in.

provider: The name of the 3rd party video provider.

id: The video id.

1 string reference to 'lightbox2_video_cck'
lightbox2_menu in ./lightbox2.module
Implementation of hook_menu().

File

./lightbox2.module, line 2002
Enables the use of lightbox2 which places images above your current page, not within. This frees you from the constraints of the layout, particularly column widths.

Code

function lightbox2_video_cck($node, $width, $height, $field_name, $provider, $id) {
  $field = array();
  $field['widget']['video_width'] = $width;
  $field['widget']['video_height'] = $height;
  $field['widget']['video_autoplay'] = 1;
  $field['field_name'] = $field_name;
  $type = $node->type;
  if (module_exists('cck_field_perms') && ($types = variable_get('cfp_types', null))) {
    if ($types[$type]) {
      $disallowed_fields = unserialize(variable_get('cfp_values', null));
      if ($disallowed_fields && $disallowed_fields[$type][$field_name] != 0) {
        if (!user_access(_cfp_content_to_readable($type, $disallowed_field, 'view'))) {
          drupal_access_denied();
          return;
        }
      }
    }
  }
  $items = $node->{$field_name};
  foreach ($items as $item) {
    if ($item['provider'] == $provider && $item['value'] == $id) {
      break;
    }
  }
  print theme('video_cck_video_video', $field, $item, 'video_video', $node);
}