You are here

function brightcove_admin_embed_publish_form_submit in Brightcove Video Connect 7.6

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

Submit handler for brightcove_admin_embed_publish_form().

_state

Parameters

array $form:

File

./brightcove.player.inc, line 691

Code

function brightcove_admin_embed_publish_form_submit(array $form, array &$form_state) {
  $bcid = $form_state['values']['bcid'];
  $player_id = $form_state['values']['player_id'];
  $embed_id = $form_state['values']['embed_id'];
  $comment = $form_state['values']['comment'];
  $client = brightcove_client_load($bcid);

  /** @var \Brightcove\API\PM $pm */
  list(, , $pm) = brightcove_create_classes($client);
  $form_state['redirect'] = "admin/config/media/brightcove/players/{$bcid}/{$player_id}";
  brightcove_try(function () use ($pm, $player_id, $embed_id, $comment) {
    $pm
      ->publishEmbed($player_id, $embed_id, $comment);
    drupal_set_message(t('Embed published.'));
  }, function () {
    drupal_set_message(t('Failed to publish embed.'), 'error');
  });
}