You are here

public function SettingsForm::submitForm in Commerce Wishlist 8.3

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/SettingsForm.php, line 122

Class

SettingsForm
Defines the wishlist settings form.

Namespace

Drupal\commerce_wishlist\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);
  $config = $this
    ->config('commerce_wishlist.settings');
  $values = $form_state
    ->getValues();
  foreach ([
    'allow_multiple',
    'default_type',
    'view_modes',
  ] as $key) {
    if (!isset($values[$key])) {
      continue;
    }
    $config
      ->set($key, $values[$key]);
  }
  $config
    ->save();
}