You are here

public function SimpleSitemapViews::enable in Simple XML sitemap 8.3

Same name and namespace in other branches
  1. 4.x 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 110

Class

SimpleSitemapViews
Class to manage sitemap data for views.

Namespace

Drupal\simple_sitemap_views

Code

public function enable() {
  $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();
}