You are here

public function RedirectFix404Form::submitForm in Redirect 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

modules/redirect_404/src/Form/RedirectFix404Form.php, line 183

Class

RedirectFix404Form
Provides a form that lists all 404 error paths and no redirect assigned yet.

Namespace

Drupal\redirect_404\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  if ($form_state
    ->getTriggeringElement()['#action'] == 'filter') {
    $form_state
      ->setRedirect('redirect_404.fix_404', [], [
      'query' => [
        'search' => trim($form_state
          ->getValue('filter')),
      ],
    ]);
  }
  else {
    $form_state
      ->setRedirect('redirect_404.fix_404');
  }
}