function dashboard_block_list_alter

Implements hook_block_list_alter().

Skip rendering dashboard blocks when not on the dashboard page itself. This prevents expensive dashboard blocks from causing performance issues on pages where they will never be displayed.

File

modules/dashboard/dashboard.module, line 124

Code

function dashboard_block_list_alter(&$blocks) {
    if (!dashboard_is_visible()) {
        foreach ($blocks as $key => $block) {
            if (in_array($block->region, dashboard_regions())) {
                unset($blocks[$key]);
            }
        }
    }
}

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