You are here

public function SettingsFormWarning::submitForm in General Data Protection Regulation Compliance 8

Implements a form submit handler.

Overrides ConfigFormBase::submitForm

File

src/Form/SettingsFormWarning.php, line 182

Class

SettingsFormWarning
Implements the form controller.

Namespace

Drupal\gdpr_compliance\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $form_state
    ->setRebuild(TRUE);
  $config = $this
    ->config('gdpr_compliance.settings');
  foreach ($this->entityTypes as $enity_type => $enity_info) {
    $config
      ->set("{$enity_type}-mode", $form_state
      ->getValue("{$enity_type}-mode"))
      ->set("{$enity_type}-bundles", $form_state
      ->getValue("{$enity_type}-bundles"));
  }
  $config
    ->set('from-morelink', $form_state
    ->getValue('from-morelink'))
    ->set('user-login', $form_state
    ->getValue('user-login'))
    ->set('user-register', $form_state
    ->getValue('user-register'))
    ->save();
}