You are here

public function BrightcoveSubscriptionDeleteForm::buildForm in Brightcove Video Connect 8

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

Form constructor.

Parameters

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

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

Return value

array The form structure.

Overrides ConfirmFormBase::buildForm

File

src/Form/BrightcoveSubscriptionDeleteForm.php, line 61

Class

BrightcoveSubscriptionDeleteForm
Builds the form for Brightcove Subscription delete.

Namespace

Drupal\brightcove\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {

  // Prevent deletion of the default Subscription entity.
  if (!empty($this->brightcoveSubscription) && $this->brightcoveSubscription
    ->isDefault()) {
    drupal_set_message($this
      ->t('The API client default Subscription cannot be deleted.'), 'error');
    return $this
      ->redirect('entity.brightcove_subscription.list');
  }
  return parent::buildForm($form, $form_state);
}