public function ChartsConfigForm::submitForm in Charts 8.4
Same name and namespace in other branches
- 8 src/Form/ChartsConfigForm.php \Drupal\charts\Form\ChartsConfigForm::submitForm()
- 8.3 src/Form/ChartsConfigForm.php \Drupal\charts\Form\ChartsConfigForm::submitForm()
- 5.0.x src/Form/ChartsConfigForm.php \Drupal\charts\Form\ChartsConfigForm::submitForm()
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/ ChartsConfigForm.php, line 97
Class
- ChartsConfigForm
- Charts Config Form.
Namespace
Drupal\charts\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$settings = $form_state
->getValue('settings');
// The settings form element is returning an unneeded 'defaults' value.
if (isset($settings['defaults'])) {
unset($settings['defaults']);
}
// Save the main settings.
$this->config
->set('charts_default_settings', $settings);
$this->config
->save();
// Invalidate cache tags to refresh any view relying on this.
$this->cacheTagsInvalidator
->invalidateTags($this->config
->getCacheTags());
parent::submitForm($form, $form_state);
}