You are here

public function SimpleSitemapViews::enable in Simple XML sitemap 4.x

Same name and namespace in other branches
  1. 8.3 modules/simple_sitemap_views/src/SimpleSitemapViews.php \Drupal\simple_sitemap_views\SimpleSitemapViews::enable()

Enables sitemap support for views.

File

modules/simple_sitemap_views/src/SimpleSitemapViews.php, line 102

Class

SimpleSitemapViews
Class to manage sitemap data for views.

Namespace

Drupal\simple_sitemap_views

Code

public function enable() : void {
  $config = $this->configFactory
    ->getEditable('views.settings');
  $display_extenders = $config
    ->get('display_extenders') ?: [];

  // Enable views display extender plugin.
  $display_extenders[self::PLUGIN_ID] = self::PLUGIN_ID;
  $config
    ->set('display_extenders', $display_extenders);
  $config
    ->save();
}