You are here

function regions_footer in Regions 6

Implementation of hook_footer().

@todo consider implementing drupal_set_content() so we can use theme_blocks()

@todo for D7 use hook_page_alter().

File

./regions.module, line 56
Add regions to the screen that are cross-theme compliant

Code

function regions_footer($main = 0) {

  // Check for current theme.
  init_theme();
  global $theme_key;
  $regions = _regions_list($theme_key);

  // Regions the user has access to are added the end of the site.
  $output = '';
  foreach ($regions as $region_name => $region_info) {

    // Check for access to regions.
    if (user_access('view ' . $region_name . ' region')) {
      $region = array();

      // Get themed blocks string.
      $blocks = _regions_blocks($region_name, $region_info);
      if (isset($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;
    }
  }
  return $output;
}