You are here

public function CustomFilterRulesDeleteForm::submitForm in Custom filter 8

Same name and namespace in other branches
  1. 2.0.x 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 88

Class

CustomFilterRulesDeleteForm
Builds the form to delete a Custom Filter.

Namespace

Drupal\customfilter\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this->customfilter
    ->deleteRule($this->rule['rid']);
  $this->customfilter
    ->save();
  drupal_set_message($this
    ->t('The rule %label has been deleted.', array(
    '%label' => $this->rule['name'],
  )));
  $form_state
    ->setRedirect('customfilter.rules.list', array(
    'customfilter' => $this->customfilter
      ->id(),
  ));
}