You are here

function blockgroup_page_alter in Block Group 7

Same name and namespace in other branches
  1. 7.2 blockgroup.module \blockgroup_page_alter()

Implements hook_page_alter().

Loop through every region and all blocks on the page. Whenever a block group is encountered, set the #base parameter of the blockgroup_pullup element to the page.

File

./blockgroup.module, line 335
Add block groups to block configuration page

Code

function blockgroup_page_alter(&$page) {
  $page['#blockgroups'] = array();
  foreach ($page as $region => &$blocks) {
    if (is_array($blocks)) {
      foreach ($blocks as $key => &$build) {

        // If we encounter a blockgroup-block, set its pullup base to
        // $page['#blockgroups'].
        if (isset($build['#type']) && $build['#type'] == 'blockgroup_pullup') {
          $build['#base'] =& $page['#blockgroups'];
        }
      }
    }
  }

  // Move all blockgroup regions into $page['#blockgroups'] in order to prevent
  // certain themes from messing with them.
  $blockgroup_regions = array_intersect_key($page, blockgroup_region_list());
  foreach (array_keys($blockgroup_regions) as $region) {
    $page['#blockgroups'][$region] =& $page[$region];
    unset($page[$region]);
  }
}