public function SimpleSitemapDisplayExtender::validateOptionsForm in Simple XML sitemap 4.x
Same name and namespace in other branches
- 8.3 modules/simple_sitemap_views/src/Plugin/views/display_extender/SimpleSitemapDisplayExtender.php \Drupal\simple_sitemap_views\Plugin\views\display_extender\SimpleSitemapDisplayExtender::validateOptionsForm()
Validate the options form.
Overrides DisplayExtenderPluginBase::validateOptionsForm
File
- modules/
simple_sitemap_views/ src/ Plugin/ views/ display_extender/ SimpleSitemapDisplayExtender.php, line 184
Class
- SimpleSitemapDisplayExtender
- Simple XML Sitemap display extender plugin.
Namespace
Drupal\simple_sitemap_views\Plugin\views\display_extenderCode
public function validateOptionsForm(&$form, FormStateInterface $form_state) {
if ($this
->hasSitemapSettings() && $form_state
->get('section') === 'simple_sitemap') {
$required_arguments = $this
->getRequiredArguments();
foreach ($this->variants as $variant_id => $variant) {
$arguments =& $form_state
->getValue([
'variants',
$variant_id,
'arguments',
], []);
$arguments = array_merge($arguments, $required_arguments);
$errors = $this
->validateIndexedArguments($arguments);
foreach ($errors as $message) {
$form_state
->setError($form['variants'][$variant_id]['arguments'], $message);
}
}
}
}