You are here

function simple_sitemap_views_install in Simple XML sitemap (Views integration) 8

Implements hook_install().

File

./simple_sitemap_views.install, line 11
Install and uninstall hooks for the simple_sitemap_views module.

Code

function simple_sitemap_views_install() {

  // Enable simple_sitemap_display_extender plugin.

  /** @var \Drupal\Core\Config\Config $config */
  $config = \Drupal::service('config.factory')
    ->getEditable('views.settings');
  $display_extenders = $config
    ->get('display_extenders') ?: [];
  $display_extenders[] = 'simple_sitemap_display_extender';
  $config
    ->set('display_extenders', $display_extenders);
  $config
    ->save();
}