You are here

public function AdsenseMainSettings::submitForm in Google AdSense integration 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/AdsenseMainSettings.php, line 142

Class

AdsenseMainSettings
Form for the adsense module general settings.

Namespace

Drupal\adsense\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->configFactory()
    ->getEditable('adsense.settings');
  $form_state
    ->cleanValues();
  foreach ($form_state
    ->getValues() as $key => $value) {
    $config
      ->set($key, Html::escape($value));
  }
  $config
    ->save();
  parent::submitForm($form, $form_state);
}