You are here

public function SimpleSitemapDisplayExtender::optionsSummary 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::optionsSummary()

Provide the default summary for options in the views UI.

This output is returned as an array.

Overrides DisplayExtenderPluginBase::optionsSummary

File

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

Class

SimpleSitemapDisplayExtender
Simple XML Sitemap display extender plugin.

Namespace

Drupal\simple_sitemap_views\Plugin\views\display_extender

Code

public function optionsSummary(&$categories, &$options) {
  if ($this
    ->hasSitemapSettings()) {
    $categories['simple_sitemap'] = [
      'title' => $this
        ->t('Simple XML Sitemap'),
      'column' => 'second',
    ];
    $included_variants = [];
    foreach (array_keys($this->variants) as $variant) {
      $settings = $this
        ->getSitemapSettings($variant);
      if ($settings['index']) {
        $included_variants[] = $variant;
      }
    }
    $options['simple_sitemap'] = [
      'title' => NULL,
      'category' => 'simple_sitemap',
      'value' => $included_variants ? $this
        ->t('Included in sitemap variants: @variants', [
        '@variants' => implode(', ', $included_variants),
      ]) : $this
        ->t('Excluded from all sitemap variants'),
    ];
  }
}