You are here

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

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