You are here

function theme_brightcove_cck_embed in Brightcove Video Connect 6

Same name and namespace in other branches
  1. 6.2 brightcove_cck/theme.inc \theme_brightcove_cck_embed()
1 string reference to 'theme_brightcove_cck_embed'
brightcove_cck_theme in brightcove_cck/brightcove_cck.module
Implementation of hook_theme().
3 theme calls to theme_brightcove_cck_embed()
brightcove_cck_player in brightcove_cck/brightcove_cck.module
Callback for brightcove_cck_player - checks access to the field and prints a player for Lightbox2.
theme_brightcove_cck_formatter_default in brightcove_cck/brightcove_cck.formatters.inc
Theme callback for Brightcove CCK formatter. Returns an embedded player with default site player.
theme_brightcove_cck_lightbox2_player in brightcove_cck/brightcove_cck.formatters.inc
Theme callback for Default thumbnail -> Lightbox2 player formatter.

File

brightcove_cck/theme.inc, line 57

Code

function theme_brightcove_cck_embed($type, $playerId, $playerKey, $assetIds, $params) {
  if (!isset($playerId)) {
    watchdog('brightcove', 'Video Player ID is missing.', array(), WATCHDOG_ERROR);
  }
  if (!isset($playerKey)) {
    watchdog('brightcove', 'Video Player KEY is missing.', array(), WATCHDOG_ERROR);
  }
  $values = array(
    'id' => 'myExperience',
    'bgcolor' => 'FFFFFF',
    'width' => 486,
    'height' => 412,
  );
  foreach ($values as $key => $value) {
    if (isset($params[$key])) {
      $values[$key] = $params[$key];
    }
  }
  $assetCode = '';
  if (isset($assetIds)) {
    if (is_array($assetIds)) {
      if (strtolower($type) == 'video') {
        $assetCode = '<param name="@videoPlayer" value="';
      }
      else {

        // TODO: Add different types than video.
      }
      foreach ($assetIds as $assetId) {
        $assetCode .= $assetId . ',';
      }
      $assetCode = substr($assetCode, 0, -1);
      $assetCode .= '" />';
    }
    else {
      if (strtolower($type) == 'video') {
        $assetCode = '<param name="@videoPlayer" value="' . $assetIds . '" />';
      }
      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="' . $playerId . '" />' . $assetCode . '
    <param name="isVid" value="true" />
    <param name="isUI" value="true" />
    <param name="playerKey" value="' . $playerKey . '" />
    </object>';
  return $code;
}