You are here

public function SimpleSitemapDisplayExtender::submitOptionsForm in Simple XML sitemap 4.x

Same name and namespace in other branches
  1. 8.3 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 203

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 ($this->variants as $variant_id => $variant) {
      $settings = $variants[$variant_id] + $this
        ->getSitemapSettings($variant_id);
      if ($settings['index']) {
        $settings['arguments'] = array_filter($settings['arguments']);
        $this->options['variants'][$variant_id] = $settings;
      }
    }
  }
}