You are here

public function FieldValidationRuleDeleteForm::submitForm in Field Validation 8

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/FieldValidationRuleDeleteForm.php, line 69

Class

FieldValidationRuleDeleteForm
Form for deleting a fieldValidationRule.

Namespace

Drupal\field_validation\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this->fieldValidationRuleSet
    ->deleteFieldValidationRule($this->fieldValidationRule);
  $this
    ->messenger()
    ->addMessage($this
    ->t('The rule %name has been deleted.', [
    '%name' => $this->fieldValidationRule
      ->label(),
  ]));
  $form_state
    ->setRedirectUrl($this->fieldValidationRuleSet
    ->toUrl('edit-form'));
}