function dashboard_enable

7.x dashboard.install dashboard_enable()

Implements hook_enable().

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

File

drupal-7.x/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');
}