You are here

function brightcove_admin_embed_preview in Brightcove Video Connect 7.6

Same name and namespace in other branches
  1. 7.7 brightcove.player.inc \brightcove_admin_embed_preview()

Gets the preview embed code and displays the embed preview, and the publish form. Used to preview the child player before publishing it.

Parameters

$bcid: The Client->bcid to use for fetching the preview.

$player_id: The player ID.

$embed_id: The embed ID.

Return value

mixed

1 string reference to 'brightcove_admin_embed_preview'
brightcove_menu in ./brightcove.module
Implements hook_menu().

File

./brightcove.player.inc, line 423

Code

function brightcove_admin_embed_preview($bcid, $player_id, $embed_id) {
  $client = brightcove_client_load($bcid);
  if (!$client) {
    drupal_not_found();
  }
  list(, , $pm) = brightcove_create_classes($client);
  $build = brightcove_try(function () use ($player_id, $embed_id, $pm) {
    $build = [];
    $embed = $pm
      ->getEmbed($player_id, $embed_id);
    $build['widget'] = [
      '#markup' => $embed
        ->getPreviewEmbedCode(),
    ];
    return $build;
  });
  if (!$build) {
    drupal_not_found();
  }
  $elements = drupal_get_form('brightcove_admin_embed_publish_form', $bcid, $player_id, $embed_id);
  $build['widget']['#markup'] .= drupal_render($elements);
  return $build;
}