function RulesComponentEditForm::save

Overrides EntityForm::save

File

src/Form/RulesComponentEditForm.php, line 77

Class

RulesComponentEditForm
Provides a form to edit a component.

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);
    // Also remove the temporarily stored component, it has been persisted now.
    $this->rulesUiHandler
        ->clearTemporaryStorage();
    $this->messenger()
        ->addMessage($this->t('Rule component %label has been updated.', [
        '%label' => $this->entity
            ->label(),
    ]));
}