You are here

sitewide_alert.install in Sitewide Alert 8

Install, update and uninstall functions for the sitewide_alert module.

File

sitewide_alert.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for the sitewide_alert module.
 */
use Drupal\Core\Session\AccountInterface;

/**
 * Implements hook_install().
 */
function sitewide_alert_install() {

  // By default allow anonymous users to view Sitewide Alerts.
  user_role_grant_permissions(AccountInterface::ANONYMOUS_ROLE, [
    'view published sitewide alert entities',
  ]);
}

/**
 * Set the new automated refresh config option to keep the current behavior.
 */
function sitewide_alert_update_8001(&$sandbox) {
  $config_factory = \Drupal::configFactory();
  $config_factory
    ->getEditable('sitewide_alert.settings')
    ->set('automatic_refresh', 1)
    ->save();
}

Functions

Namesort descending Description
sitewide_alert_install Implements hook_install().
sitewide_alert_update_8001 Set the new automated refresh config option to keep the current behavior.