You are here

function brightcove_field_player in Brightcove Video Connect 7.2

Same name and namespace in other branches
  1. 7.7 brightcove.module \brightcove_field_player()
  2. 7.3 brightcove_field/brightcove_field.module \brightcove_field_player()
  3. 7.4 brightcove_field/brightcove_field.module \brightcove_field_player()
  4. 7.5 brightcove_field/brightcove_field.module \brightcove_field_player()
  5. 7.6 brightcove.module \brightcove_field_player()

Callback for brightcove_field_player - checks access to the field and prints a player for Lightbox2.

Parameters

$node: Node object.

$field_name: Field that is being displayed.

$delta: Field delta.

Return value

array

1 string reference to 'brightcove_field_player'
brightcove_field_menu in brightcove_field/brightcove_field.module
Implementation of hook_menu().

File

brightcove_field/brightcove_field.module, line 139
Brightcove field module provides a Content Construction Kit module to developers, allowing them to browse videos in their Brightcove Studio and upload them.

Code

function brightcove_field_player($entity_type, $entity_id, $field_name, $delta) {
  $entities = entity_load($entity_type, array(
    $entity_id,
  ));
  $entity = array_shift($entities);
  $video_id = $entity->{$field_name}[isset($entity->language) ? $entity->language : 'und'][$delta]['video_id'];
  $player_name = $entity->{$field_name}[isset($entity->language) ? $entity->language : 'und'][$delta]['player_id'];
  list(, , $bundle) = entity_extract_ids($entity_type, $entity);
  $instance = field_info_instance($entity_type, $field_name, $bundle);
  return array(
    '#theme' => 'brightcove_field_embed',
    '#video_id' => $video_id,
    '#attached' => array(
      'js' => array(
        'http://admin.brightcove.com/js/BrightcoveExperiences.js',
      ),
    ),
    '#player' => brightcove_field_get_value($instance, $player_name),
  );
}