You are here

function theme_brightcove_field_embed in Brightcove Video Connect 7.2

1 string reference to 'theme_brightcove_field_embed'
brightcove_field_theme in brightcove_field/brightcove_field.module
Implementation of hook_theme().
3 theme calls to theme_brightcove_field_embed()
brightcove_field_player in brightcove_field/brightcove_field.module
Callback for brightcove_field_player - checks access to the field and prints a player for Lightbox2.
brightcove_media_file_formatter_video_view in brightcove_media/brightcove_media.module
theme_brightcove_field_formatter_default in brightcove_field/brightcove_field.formatters.inc
Theme callback for Brightcove field formatter. Returns an embedded player with default site player.

File

brightcove_field/theme.inc, line 61

Code

function theme_brightcove_field_embed($variables) {
  if (!isset($variables['player'])) {
    watchdog('brightcove', 'Video Player is missing.', array(), WATCHDOG_ERROR);
  }
  $player = brightcove_player_load($variables['player']);
  $values = array(
    'id' => 'myExperience',
    'bgcolor' => 'FFFFFF',
    'width' => $variables['width'],
    'height' => $variables['height'],
  );
  foreach ($values as $key => $value) {
    if (isset($variables['params'][$key])) {
      $values[$key] = $variables['params'][$key];
    }
  }
  $assetCode = '';
  if (isset($variables['video_id'])) {
    if (is_array($variables['video_id'])) {
      if (strtolower($variables['type']) == 'video') {
        $assetCode = '<param name="@videoPlayer" value="';
      }
      else {

        // TODO: Add different types than video.
      }
      foreach ($variables['video_id'] as $assetId) {
        $assetCode .= $assetId . ',';
      }
      $assetCode = substr($assetCode, 0, -1);
      $assetCode .= '" />';
    }
    else {
      if (strtolower($variables['type']) == 'video') {
        $assetCode = '<param name="@videoPlayer" value="' . $variables['video_id'] . '" />';
      }
      else {

        // TODO: Add different types than video.
      }
    }
  }
  $code = '
    <object id="' . $values['id'] . '" class="BrightcoveExperience">
    <param name="bgcolor" value="#' . $values['bgcolor'] . '" />
    <param name="width" value="' . $values['width'] . '" />
    <param name="height" value="' . $values['height'] . '" />
    <param name="playerID" value="' . $player->player_id . '" />' . $assetCode . '
    <param name="isVid" value="true" />
    <param name="isUI" value="true" />
    <param name="playerKey" value="' . $player->player_key . '" />
    </object>';
  return $code;
}