You are here

public function Fz152Settings::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/Fz152Settings.php, line 57

Class

Fz152Settings
Configure example settings for this site.

Namespace

Drupal\fz152\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this
    ->config('fz152.settings')
    ->set('enable', $form_state
    ->getValue('enable'))
    ->set('is_checkbox', $form_state
    ->getValue('is_checkbox'))
    ->set('checkbox_title', $form_state
    ->getValue('checkbox_title'))
    ->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);
}