You are here

public function ChecklistapiChecklistClearForm::submitForm in Checklist API 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/ChecklistapiChecklistClearForm.php, line 76

Class

ChecklistapiChecklistClearForm
Provides a form to clear saved progress for a given checklist.

Namespace

Drupal\checklistapi\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {

  // Clear saved progress.
  $form['#checklist']
    ->clearSavedProgress();

  // Redirect back to checklist.
  $form_state
    ->setRedirect($form['#checklist']
    ->getRouteName());
}