public function SitemapSettingsForm::submitForm in Sitemap 8.2
Same name and namespace in other branches
- 8 src/Form/SitemapSettingsForm.php \Drupal\sitemap\Form\SitemapSettingsForm::submitForm()
- 2.0.x src/Form/SitemapSettingsForm.php \Drupal\sitemap\Form\SitemapSettingsForm::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/ SitemapSettingsForm.php, line 204
Class
- SitemapSettingsForm
- Provides a configuration form for sitemap.
Namespace
Drupal\sitemap\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$config = $this->configFactory
->getEditable('sitemap.settings');
// Save config.
foreach ($form_state
->cleanValues()
->getValues() as $key => $value) {
if ($key == 'plugins') {
foreach ($value as $instance_id => $plugin_config) {
// Update the plugin configurations.
$this->plugins[$instance_id]
->setConfiguration($plugin_config);
}
// Save in sitemap.settings.
$config
->set($key, $value);
}
else {
$config
->set($key, $value);
}
}
$config
->save();
//@TODO Is a more targeted cache cleanup possible?
drupal_flush_all_caches();
parent::submitForm($form, $form_state);
}