public function AdsenseManagedSettings::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/ AdsenseManagedSettings.php, line 130
Class
- AdsenseManagedSettings
- Form for the adsense managed ads settings.
Namespace
Drupal\adsense\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$config = $this
->configFactory()
->getEditable('adsense.settings');
$form_state
->cleanValues();
$this->condition
->submitConfigurationForm($form, $form_state);
$config
->set('adsense_access_pages', $this->condition
->getConfiguration());
// Don't store the condition values separately.
$values = $form_state
->getValues();
unset($values['pages']);
unset($values['negate']);
foreach ($values as $key => $value) {
$config
->set($key, Html::escape($value));
}
$config
->save();
parent::submitForm($form, $form_state);
}