function overlay_block_list_alter

Implements hook_block_list_alter().

File

modules/overlay/overlay.module, line 449

Code

function overlay_block_list_alter(&$blocks) {
    // If we are limiting rendering to a subset of page regions, hide all blocks
    // which appear in regions not on that list. Note that overlay_page_alter()
    // does a more comprehensive job of preventing unwanted regions from being
    // displayed (regardless of whether they contain blocks or not), but the
    // reason for duplicating effort here is performance; we do not even want
    // these blocks to be built if they are not going to be displayed.
    if ($regions_to_render = overlay_get_regions_to_render()) {
        foreach ($blocks as $bid => $block) {
            if (!in_array($block->region, $regions_to_render)) {
                unset($blocks[$bid]);
            }
        }
    }
}

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