public function SimplesitemapSettingsForm::submitForm in Simple XML sitemap 8.3
Same name and namespace in other branches
- 8.2 src/Form/SimplesitemapSettingsForm.php \Drupal\simple_sitemap\Form\SimplesitemapSettingsForm::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/ SimplesitemapSettingsForm.php, line 206
Class
- SimplesitemapSettingsForm
- Class SimplesitemapSettingsForm @package Drupal\simple_sitemap\Form
Namespace
Drupal\simple_sitemap\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
foreach ([
'max_links',
'cron_generate',
'cron_generate_interval',
'remove_duplicates',
'skip_untranslated',
'xsl',
'base_url',
'default_variant',
'disable_language_hreflang',
'entities_per_queue_item',
] as $setting_name) {
$this->generator
->saveSetting($setting_name, $form_state
->getValue($setting_name));
}
$this->generator
->saveSetting('excluded_languages', array_filter($form_state
->getValue('excluded_languages')));
$this->generator
->saveSetting('generate_duration', $form_state
->getValue('generate_duration') * 1000);
parent::submitForm($form, $form_state);
// Regenerate sitemaps according to user setting.
if ($form_state
->getValue('simple_sitemap_regenerate_now')) {
$this->generator
->setVariants(TRUE)
->rebuildQueue()
->generateSitemap();
}
}