You are here

sitemap.install in Sitemap 8

Same filename and directory in other branches
  1. 8.2 sitemap.install
  2. 2.0.x sitemap.install

Installation functions for Sitemap module.

File

sitemap.install
View source
<?php

/**
 * @file
 * Installation functions for Sitemap module.
 */

/**
 * Change sitemap configuration page permission to administer sitemap.
 */
function sitemap_update_8101() {
  $roles = user_roles(FALSE, 'administer site configuration');
  if (!empty($roles)) {
    foreach ($roles as $rid => $role) {
      user_role_grant_permissions($rid, [
        'administer sitemap',
      ]);
    }
  }
}

/**
 * Update the CSS configuration setting to reflect the change in option wording
 * (from negation to affirmation).
 */
function sitemap_update_8102(&$sandbox) {
  $config_factory = \Drupal::configFactory();
  $config = $config_factory
    ->getEditable('sitemap.settings');
  if ($config
    ->get('css')) {
    $css = $config
      ->get('css') == TRUE ? FALSE : TRUE;
    $config
      ->set('css', $css);
  }
  $config
    ->save();
}

Functions

Namesort descending Description
sitemap_update_8101 Change sitemap configuration page permission to administer sitemap.
sitemap_update_8102 Update the CSS configuration setting to reflect the change in option wording (from negation to affirmation).