You are here

public function FlagResetForm::submitForm in Flag 8.4

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/FlagResetForm.php, line 100

Class

FlagResetForm
Provides the flag reset form.

Namespace

Drupal\flag\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this->flagService
    ->unflagAllByFlag($this->flag);
  $this
    ->messenger()
    ->addMessage($this
    ->t('Flag %label was reset.', [
    '%label' => $this->flag
      ->label(),
  ]));
  $form_state
    ->setRedirectUrl($this
    ->getCancelUrl());
}