summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2005-08-16 18:06:18 +0000
committerDries Buytaert <dries@buytaert.net>2005-08-16 18:06:18 +0000
commit26fa7c730f878220a46478c47f6145f459f68688 (patch)
tree16c0ce7230150b0f8cee0f4d360c9756f8746764 /includes
parent6ef678e4475c6e500b371be6f5a9a66115686480 (diff)
downloadbrdo-26fa7c730f878220a46478c47f6145f459f68688.tar.gz
brdo-26fa7c730f878220a46478c47f6145f459f68688.tar.bz2
- Patch #16216 by nedjo: multiple block regions!
Diffstat (limited to 'includes')
-rw-r--r--includes/common.inc44
-rw-r--r--includes/theme.inc6
2 files changed, 49 insertions, 1 deletions
diff --git a/includes/common.inc b/includes/common.inc
index c38743c54..c9b61d402 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -25,6 +25,50 @@ define('SAVED_UPDATED', 2);
define('SAVED_DELETED', 3);
/**
+ * Set content for a specified region.
+ *
+ * @param $region
+ * Page region the content is assigned to.
+ *
+ * @param $data
+ * Content to be set.
+ */
+function drupal_set_content($region = null, $data = null) {
+ static $content = array();
+
+ if (!is_null($region) && !is_null($data)) {
+ $content[$region][] = $data;
+ }
+ return $content;
+}
+
+/**
+ * Get assigned content.
+ *
+ * @param $region
+ * A specified region to fetch content for. If null, all regions will be returned.
+ *
+ * @param $delimiter
+ * Content to be inserted between exploded array elements.
+ */
+function drupal_get_content($region = null, $delimiter = ' ') {
+ $content = drupal_set_content();
+ if (isset($region)) {
+ if (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;
+ }
+}
+
+/**
* Set the breadcrumb trail for the current page.
*
* @param $breadcrumb
diff --git a/includes/theme.inc b/includes/theme.inc
index 559640e8c..edbd8d58c 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -798,7 +798,7 @@ function theme_box($title, $content, $region = 'main') {
*
* @param $block
* An object populated with fields from the "blocks" database table
- * ($block->module, $block->delta, $block->region, ...) and fields returned by
+ * ($block->module, $block->delta ...) and fields returned by
* <i>module</i>_block('view') ($block->subject, $block->content, ...).
* @return
* A string containing the block output.
@@ -945,6 +945,10 @@ function theme_blocks($region) {
$output .= theme('block', $block);
}
}
+
+ // Add any content assigned to this region through drupal_set_content() calls.
+ $output .= drupal_get_content($region);
+
return $output;
}