You are here

public function ShortcutPerRoleSettingsForm::submitForm in Shortcut per Role 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/ShortcutPerRoleSettingsForm.php, line 59

Class

ShortcutPerRoleSettingsForm
Configure Shortcut per Role settings for this site.

Namespace

Drupal\shortcutperrole\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $form_state
    ->cleanValues();
  foreach ($form_state
    ->getValues() as $role => $set) {
    $this
      ->config('shortcutperrole.settings')
      ->set('role.' . $role, $set)
      ->save();
  }
  parent::submitForm($form, $form_state);
}