function regions_page_alter in Regions 7
Implements hook_page_alter().
File
- ./
regions.module, line 54 - Add regions to the screen that are cross-theme compliant
Code
function regions_page_alter(&$page) {
// Check for current theme.
global $theme_key;
$regions = _regions_list($theme_key);
// Regions the user has access to are added to the end of site.
$output = '';
foreach ($regions as $region_name => $region_info) {
// Check for access to regions.
if (user_access('view ' . $region_name . ' region')) {
$region = array(
'start' => '',
'blocks' => '',
'end' => '',
);
// Get themed blocks string.
$blocks = _regions_blocks($region_name, $region_info);
if (!empty($blocks)) {
$region['start'] = '<div id="' . $region_name . '" class="regions">';
$region['blocks'] .= $blocks;
$region['end'] .= '</div>';
}
// Allow other modules to alter the region array before the each element
// is concatenated into a single HTML string.
drupal_alter('regions_region', $region, $region_name);
$output .= !empty($region) ? implode('', $region) : NULL;
}
}
// append output to page via normal page rendering
$page['page_bottom']['regions_module'] = array(
'#type' => 'markup',
'#markup' => $output,
);
}