You are here

public function MenuManipulatorSettingsForm::submitForm in Menu Manipulator 8

Same name and namespace in other branches
  1. 8.2 src/Form/MenuManipulatorSettingsForm.php \Drupal\menu_manipulator\Form\MenuManipulatorSettingsForm::submitForm()
  2. 3.0.x src/Form/MenuManipulatorSettingsForm.php \Drupal\menu_manipulator\Form\MenuManipulatorSettingsForm::submitForm()
  3. 2.0.x src/Form/MenuManipulatorSettingsForm.php \Drupal\menu_manipulator\Form\MenuManipulatorSettingsForm::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/MenuManipulatorSettingsForm.php, line 178

Class

MenuManipulatorSettingsForm
Configure custom settings for Menu Manipulators.

Namespace

Drupal\menu_manipulator\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this->configFactory
    ->getEditable('menu_manipulator.settings');
  $exclude = [
    'submit',
    'form_build_id',
    'form_token',
    'form_id',
    'op',
  ];
  foreach ($form_state
    ->getValues() as $key => $data) {
    if (!in_array($key, $exclude)) {
      $config
        ->set($key, $data);
    }
  }
  $config
    ->save();
  parent::submitForm($form, $form_state);
}