You are here

function videojs_field_formatter_view in Video.js (HTML5 Video Player) 7

Same name and namespace in other branches
  1. 7.3 videojs.module \videojs_field_formatter_view()
  2. 7.2 videojs.module \videojs_field_formatter_view()

Implements hook_field_formatter_view().

File

./videojs.module, line 72
Provides an HTML5-compatible with Flash-fallback video player.

Code

function videojs_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
  if ($display['type'] != 'videojs') {
    return array();
  }
  list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);
  return array(
    array(
      '#theme' => 'videojs',
      '#items' => $items,
      '#player_id' => 'videojs-' . $id . '-' . str_replace('_', '-', $instance['field_name']),
      '#attached' => videojs_add(FALSE),
    ),
  );
}