You are here

function brightcove_admin_player_delete_form_submit in Brightcove Video Connect 7.7

Same name and namespace in other branches
  1. 7.6 brightcove.player.inc \brightcove_admin_player_delete_form_submit()

Submit handler for brightcove_admin_player_delete_form().

_state

Parameters

array $form:

File

./brightcove.player.inc, line 296

Code

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

  /** @var \Brightcove\API\PM $pm */
  list(, , $pm) = brightcove_create_classes($client);
  $form_state['redirect'] = 'admin/config/media/brightcove/players';
  brightcove_try(function () use ($pm, $player_id) {
    $pm
      ->deletePlayer($player_id);
    drupal_set_message(t('Player deleted.'));
  }, function () {
    drupal_set_message(t('Failed to delete player.'), 'error');
  });
}