You are here

public function RenameAdminPathsSettingsForm::submitForm in Rename Admin Paths 8.2

Same name and namespace in other branches
  1. 8 src/Form/RenameAdminPathsSettingsForm.php \Drupal\rename_admin_paths\Form\RenameAdminPathsSettingsForm::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 ConfigFormBase::submitForm

File

src/Form/RenameAdminPathsSettingsForm.php, line 162

Class

RenameAdminPathsSettingsForm

Namespace

Drupal\rename_admin_paths\Form

Code

public function submitForm(array &$form, FormStateInterface $formState) {
  $this
    ->saveConfiguration($formState);

  // at this stage we rebuild all routes to use the new renamed paths
  $this->routeBuilder
    ->rebuild();

  // add confirmation message
  parent::submitForm($form, $formState);

  // make sure we end up at the same form again using the new path
  $formState
    ->setRedirect('rename_admin_paths.admin');
}