You are here

public function RedirectSettingsForm::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 ConfigFormBase::submitForm

File

src/Form/RedirectSettingsForm.php, line 82

Class

RedirectSettingsForm

Namespace

Drupal\redirect\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->config('redirect.settings');
  foreach ($form_state
    ->getValues() as $key => $value) {
    if (strpos($key, 'redirect_') !== FALSE) {
      $config
        ->set(str_replace('redirect_', '', $key), $value);
    }
  }
  $config
    ->save();
  parent::submitForm($form, $form_state);
}