You are here

public function SimpleSitemapDisplayExtender::displaySitemapSettingsForm in Simple XML sitemap (Views integration) 8

Displays the sitemap settings form.

Parameters

array $form: The form structure.

FormStateInterface $form_state: Current form state.

File

src/Plugin/views/display_extender/SimpleSitemapDisplayExtender.php, line 248
Contains Simple XML Sitemap display extender.

Class

SimpleSitemapDisplayExtender
Simple XML Sitemap display extender plugin.

Namespace

Drupal\simple_sitemap_views\Plugin\views\display_extender

Code

public function displaySitemapSettingsForm(array $form, FormStateInterface $form_state) {

  // Update index option.
  $this->options['index'] = empty($this->options['index']);

  // Rebuild settings form.

  /** @var \Drupal\views_ui\ViewUI $view */
  $view = $form_state
    ->get('view');
  $display_handler = $view
    ->getExecutable()->display_handler;
  $extender_options = $display_handler
    ->getOption('display_extenders');
  if (isset($extender_options[$this->pluginId])) {
    $extender_options[$this->pluginId] = $this->options;
    $display_handler
      ->setOption('display_extenders', $extender_options);
  }
  $view
    ->cacheSet();
  $form_state
    ->set('rerender', TRUE);
  $form_state
    ->setRebuild();
}