function DeleteEventForm::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/DeleteEventForm.php, line 136

Class

DeleteEventForm
Removes an event from a rule.

Namespace

Drupal\rules\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this->reactionRule
    ->removeEvent($this->id);
  $this->reactionRule
    ->save();
  $this->messenger()
    ->addMessage($this->t('Deleted event %label from %rule.', [
    '%label' => $this->eventManager
      ->getDefinition($this->id)['label'],
    '%rule' => $this->reactionRule
      ->label(),
  ]));
  $form_state->setRedirectUrl($this->getCancelUrl());
}