function dashboard_disable

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.

File

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

Code

function dashboard_disable() {
  // Stash a list of currently enabled blocks.
  $stashed_blocks = array();

  $result = db_select('block', 'b')
    ->fields('b', array('module', 'delta', 'region'))
    ->condition('b.region', dashboard_regions(), 'IN')
    ->execute();

  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.
  db_update('block')
    ->fields(array(
      'status' => 0,
      'region' => BLOCK_REGION_NONE,
    ))
    ->condition('region', dashboard_regions(), 'IN')
    ->execute();
}

© 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_disable/7.x