function ReactionRuleEditForm::save

Overrides EntityForm::save

File

src/Form/ReactionRuleEditForm.php, line 170

Class

ReactionRuleEditForm
Provides a form to edit a reaction rule.

Namespace

Drupal\rules\Form

Code

public function save(array $form, FormStateInterface $form_state) {
  $this->rulesUiHandler
    ->getForm()
    ->submitForm($form, $form_state);
  $component = $this->rulesUiHandler
    ->getComponent();
  $this->entity
    ->updateFromComponent($component);
  // Persist changes by saving the entity.
  parent::save($form, $form_state);
  // Remove the temporarily stored component; it has been persisted now.
  $this->rulesUiHandler
    ->clearTemporaryStorage();
  $this->messenger()
    ->addMessage($this->t('Reaction rule %label has been updated.', [
    '%label' => $this->entity
      ->label(),
  ]));
}