public function CustomFilterRulesDeleteForm::submitForm in Custom filter 2.0.x
Same name and namespace in other branches
- 8 src/Form/CustomFilterRulesDeleteForm.php \Drupal\customfilter\Form\CustomFilterRulesDeleteForm::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/ CustomFilterRulesDeleteForm.php, line 92
Class
- CustomFilterRulesDeleteForm
- Builds the form to delete a Custom Filter.
Namespace
Drupal\customfilter\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->customfilter
->deleteRule($this->rule['rid']);
$this->customfilter
->save();
$this
->messenger()
->addStatus($this
->t('The rule %label has been deleted.', [
'%label' => $this->rule['name'],
]));
$form_state
->setRedirect('customfilter.rules.list', [
'customfilter' => $this->customfilter
->id(),
]);
}