function 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

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');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.