function dashboard_enable

dashboard_enable()

Implements hook_enable().

Restores blocks to the dashboard that were there when the dashboard module was disabled.

File

modules/dashboard/dashboard.install, line 49
Install, update and uninstall functions for the dashboard module.

Code

function dashboard_enable() {
  global $theme_key;
  if (!$stashed_blocks = variable_get('dashboard_stashed_blocks')) {
    return;
  }
  if (!$admin_theme = variable_get('admin_theme')) {
    drupal_theme_initialize();
    $admin_theme = $theme_key;
  }
  foreach ($stashed_blocks as $block) {
    db_update('block')
      ->fields(array(
        'status' => 1,
        'region' => $block['region']
      ))
      ->condition('module', $block['module'])
      ->condition('delta', $block['delta'])
      ->condition('theme', $admin_theme)
      ->condition('status', 0)
      ->execute();
  }
  variable_del('dashboard_stashed_blocks');
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!dashboard!dashboard.install/function/dashboard_enable/7.x