You are here

public function MenuAttributesSettingsForm::submitForm in Menu Attributes 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/MenuAttributesSettingsForm.php, line 82

Class

MenuAttributesSettingsForm
Configure Menu Attributes admin settings.

Namespace

Drupal\menu_attributes\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $values = $form_state
    ->getValues();
  foreach ($values['attributes'] as $attribute => $value) {
    $this
      ->config('menu_attributes.settings')
      ->set('attribute_enable.' . $attribute, $value['attribute_enable'])
      ->set('attribute_default.' . $attribute, $value['attribute_default'])
      ->save();
  }
  parent::submitForm($form, $form_state);
}