You are here

public function SimpleSitemapViews::disable 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::disable()

Disables sitemap support for views.

File

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

Class

SimpleSitemapViews
Class to manage sitemap data for views.

Namespace

Drupal\simple_sitemap_views

Code

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

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

  // Clear the table with indexed arguments.
  // Clear the garbage collection queue.
  $this
    ->removeArgumentsFromIndex();
  $queue = $this->queueFactory
    ->get('simple_sitemap.views.garbage_collector');
  $queue
    ->deleteQueue();
}