You are here

function drupal_get_region_content in Drupal 7

Gets assigned content for a given region.

Parameters

$region: A specified region to fetch content for. If NULL, all regions will be returned.

$delimiter: Content to be inserted between imploded array elements.

3 calls to drupal_get_region_content()
DrupalSetContentTestCase::testRegions in modules/simpletest/tests/common.test
Test setting and retrieving content for theme regions.
template_preprocess_maintenance_page in includes/theme.inc
Process variables for maintenance-page.tpl.php.
template_preprocess_page in includes/theme.inc
Preprocess variables for page.tpl.php

File

includes/common.inc, line 193
Common functions that many Drupal modules will need to reference.

Code

function drupal_get_region_content($region = NULL, $delimiter = ' ') {
  $content = drupal_add_region_content();
  if (isset($region)) {
    if (isset($content[$region]) && is_array($content[$region])) {
      return implode($delimiter, $content[$region]);
    }
  }
  else {
    foreach (array_keys($content) as $region) {
      if (is_array($content[$region])) {
        $content[$region] = implode($delimiter, $content[$region]);
      }
    }
    return $content;
  }
}