You are here

function theme_brightcove_cck_formatter_default in Brightcove Video Connect 6

Same name and namespace in other branches
  1. 6.2 brightcove_cck/brightcove_cck.formatters.inc \theme_brightcove_cck_formatter_default()

Theme callback for Brightcove CCK formatter. Returns an embedded player with default site player.

Parameters

$element: Element with the Video ID.

Return value

Player HTML code.

File

brightcove_cck/brightcove_cck.formatters.inc, line 118
Formatters for video CCK field.

Code

function theme_brightcove_cck_formatter_default($element) {
  $player = '';
  if (isset($element['#item']['video_id'])) {

    // We need to write a BC JavaScript to the page, which is not possible
    // with a simple drupal_add_js(), inline is needed.
    static $vidcount = 1;
    if ($vidcount == 1) {
      drupal_set_html_head('<script type="text/javascript" src="http://admin.brightcove.com/js/BrightcoveExperiences.js"></script>');
    }
    $params['id'] = 'myExperience' . $vidcount;
    $player = theme('brightcove_cck_embed', 'video', variable_get('brightcove_player', ''), variable_get('brightcove_player_key', ''), $element['#item']['video_id'], $params);
    $vidcount++;
  }
  if ($player) {
    return theme('brightcove_cck_player', $player, $element['#item']['video_id']);
  }
}