You are here

public function BrightcoveSubscriptionDeleteForm::submitForm in Brightcove Video Connect 8

Same name and namespace in other branches
  1. 8.2 src/Form/BrightcoveSubscriptionDeleteForm.php \Drupal\brightcove\Form\BrightcoveSubscriptionDeleteForm::submitForm()
  2. 3.x src/Form/BrightcoveSubscriptionDeleteForm.php \Drupal\brightcove\Form\BrightcoveSubscriptionDeleteForm::submitForm()

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormInterface::submitForm

File

src/Form/BrightcoveSubscriptionDeleteForm.php, line 74

Class

BrightcoveSubscriptionDeleteForm
Builds the form for Brightcove Subscription delete.

Namespace

Drupal\brightcove\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  try {
    $this->brightcoveSubscription
      ->delete(FALSE);
  } catch (APIException $e) {
    drupal_set_message($e
      ->getMessage(), 'error');
  }
  drupal_set_message($this
    ->t('Subscription has been successfully deleted.'));
  $form_state
    ->setRedirect('entity.brightcove_subscription.list');
}