You are here

toolbar_themes.install in Toolbar Themes 8

File

toolbar_themes.install
View source
<?php

/**
 * Implements hook_modules_installed().
 * @param $modules
 */
function toolbar_themes_modules_installed($modules) {

  // Force a cache flush.
  if (in_array('toolbar_themes', $modules)) {
    drupal_flush_all_caches();
  }
}

/**
 * Implements hook_install().
 */
function toolbar_themes_install() {
  if ($roles = user_roles(FALSE, 'access toolbar')) {
    foreach ($roles as $rid => $role) {
      user_role_grant_permissions($rid, [
        'configure toolbar_themes',
      ]);
    }
  }
}

/**
 * Assign "Configure administration toolbar themes" permission to all roles.
 */
function toolbar_themes_update_8001() {
  if ($roles = user_roles(FALSE, 'access toolbar')) {
    foreach ($roles as $rid => $role) {
      user_role_grant_permissions($rid, [
        'configure toolbar_themes',
      ]);
    }
  }
}

Functions

Namesort descending Description
toolbar_themes_install Implements hook_install().
toolbar_themes_modules_installed Implements hook_modules_installed().
toolbar_themes_update_8001 Assign "Configure administration toolbar themes" permission to all roles.