7.x dashboard.install dashboard_disable()

Implements hook_disable().

Stash a list of blocks enabled on the dashboard, so they can be re-enabled if the dashboard is re-enabled. Then disable those blocks, since the dashboard regions will no longer be defined.


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


function dashboard_disable() {

  // Stash a list of currently enabled blocks.
  $stashed_blocks = array();
  $result = db_select('block', 'b')
    ->fields('b', array(
    ->condition('b.region', dashboard_regions(), 'IN')
  foreach ($result as $block) {
    $stashed_blocks[] = array(
      'module' => $block->module,
      'delta' => $block->delta,
      'region' => $block->region,
  variable_set('dashboard_stashed_blocks', $stashed_blocks);

  // Disable the dashboard blocks.
    'status' => 0,
    'region' => BLOCK_REGION_NONE,
    ->condition('region', dashboard_regions(), 'IN')