You are here

public function Fz152SettingsPage::submitForm in FZ152 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/Fz152SettingsPage.php, line 66

Class

Fz152SettingsPage
Configure example settings for this site.

Namespace

Drupal\fz152\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this
    ->config('fz152.privacy_policy_page')
    ->set('enable', $form_state
    ->getValue('enabled'))
    ->set('path', $form_state
    ->getValue('path'))
    ->set('title', $form_state
    ->getValue('title'))
    ->set('text', $form_state
    ->getValue('text'))
    ->save();

  // Rebuilding the menu router cache to register routes for settings forms.
  \Drupal::service('router.builder')
    ->rebuild();
  $this
    ->messenger()
    ->addStatus($this
    ->t('Menu router cache data rebuilded.'));
  parent::submitForm($form, $form_state);
}