You are here

public function SimpleSitemapDisplayExtender::submitOptionsForm in Simple XML sitemap 8.3

Same name and namespace in other branches
  1. 4.x modules/simple_sitemap_views/src/Plugin/views/display_extender/SimpleSitemapDisplayExtender.php \Drupal\simple_sitemap_views\Plugin\views\display_extender\SimpleSitemapDisplayExtender::submitOptionsForm()

Handle any special handling on the validate form.

Overrides DisplayExtenderPluginBase::submitOptionsForm

File

modules/simple_sitemap_views/src/Plugin/views/display_extender/SimpleSitemapDisplayExtender.php, line 214

Class

SimpleSitemapDisplayExtender
Simple XML Sitemap display extender plugin.

Namespace

Drupal\simple_sitemap_views\Plugin\views\display_extender

Code

public function submitOptionsForm(&$form, FormStateInterface $form_state) {
  if ($this
    ->hasSitemapSettings() && $form_state
    ->get('section') == 'simple_sitemap') {
    $variants = $form_state
      ->getValue('variants');
    $this->options['variants'] = [];

    // Save settings for each variant.
    foreach (array_keys($this->variants) as $variant) {
      $settings = $variants[$variant] + $this
        ->getSitemapSettings($variant);
      if ($settings['index']) {
        $settings['arguments'] = array_filter($settings['arguments']);
        $this->options['variants'][$variant] = $settings;
      }
    }
  }
}