Index: database/database.mysql =================================================================== RCS file: /cvs/drupal/drupal/database/database.mysql,v retrieving revision 1.189 diff -u -r1.189 database.mysql --- database/database.mysql 6 Jun 2005 18:59:36 -0000 1.189 +++ database/database.mysql 1 Jul 2005 21:21:25 -0000 @@ -123,7 +123,8 @@ delta varchar(32) NOT NULL default '0', status tinyint(2) DEFAULT '0' NOT NULL, weight tinyint(1) DEFAULT '0' NOT NULL, - region tinyint(1) DEFAULT '0' NOT NULL, + region varchar(64) DEFAULT 'left' NOT NULL, + themed tinyint(1) DEFAULT '0' NOT NULL, custom tinyint(2) DEFAULT '0' NOT NULL, throttle tinyint(1) DEFAULT '0' NOT NULL, visibility tinyint(1) DEFAULT '0' NOT NULL, @@ -153,6 +154,7 @@ body longtext, info varchar(128) NOT NULL default '', format int(4) NOT NULL default '0', + themed tinyint(1) DEFAULT '0' NOT NULL, PRIMARY KEY (bid), UNIQUE KEY info (info) ) TYPE=MyISAM; Index: database/database.pgsql =================================================================== RCS file: /cvs/drupal/drupal/database/database.pgsql,v retrieving revision 1.128 diff -u -r1.128 database.pgsql --- database/database.pgsql 27 Jun 2005 04:45:36 -0000 1.128 +++ database/database.pgsql 1 Jul 2005 21:21:58 -0000 @@ -118,7 +118,8 @@ delta varchar(32) NOT NULL default '0', status smallint NOT NULL default '0', weight smallint NOT NULL default '0', - region smallint NOT NULL default '0', + region varchar(64) DEFAULT 'left' NOT NULL, + themed smallint NOT NULL default '0', custom smallint NOT NULL default '0', throttle smallint NOT NULL default '0', visibility smallint NOT NULL default '0', @@ -149,6 +150,7 @@ body text default '', info varchar(128) NOT NULL default '', format smallint NOT NULL default '0', + themed smallint NOT NULL default '0', PRIMARY KEY (bid), UNIQUE (info) ); Index: database/updates.inc =================================================================== RCS file: /cvs/drupal/drupal/database/updates.inc,v retrieving revision 1.119 diff -u -r1.119 updates.inc --- database/updates.inc 14 May 2005 09:23:47 -0000 1.119 +++ database/updates.inc 1 Jul 2005 22:27:23 -0000 @@ -116,7 +116,8 @@ "2005-05-09" => "update_137", "2005-05-10" => "update_138", "2005-05-11" => "update_139", - "2005-05-12" => "update_140" + "2005-05-12" => "update_140", + "2005-06-26" => "update_141" ); function update_32() { @@ -2502,6 +2503,20 @@ return $ret; } +function update_141() { + $ret = array(); + + $ret[] = update_sql("ALTER TABLE {blocks} CHANGE region region varchar(64) default 'left' NOT NULL"); + $ret[] = update_sql("ALTER TABLE {blocks} ADD themed tinyint(1) DEFAULT '0' NOT NULL,"); + $ret[] = update_sql("ALTER TABLE {boxes} ADD themed tinyint(1) DEFAULT '0' NOT NULL,"); + $ret[] = update_sql("UPDATE {blocks} SET region = 'left' WHERE region = '0'"); + $ret[] = update_sql("UPDATE {blocks} SET region = 'right' WHERE region = '1'"); + $ret[] = update_sql("UPDATE {blocks} SET themed = '1'"); + $ret[] = update_sql("UPDATE {boxes} SET themed = '1'"); + + return $ret; +} + function update_sql($sql) { $edit = $_POST["edit"]; $result = db_query($sql); Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.456 diff -u -r1.456 common.inc --- includes/common.inc 22 Jun 2005 20:19:57 -0000 1.456 +++ includes/common.inc 28 Jun 2005 16:33:13 -0000 @@ -25,6 +25,48 @@ 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) && 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 Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.245 diff -u -r1.245 theme.inc --- includes/theme.inc 2 Jul 2005 12:32:09 -0000 1.245 +++ includes/theme.inc 2 Jul 2005 20:47:28 -0000 @@ -910,14 +910,34 @@ * A string containing the themed blocks for this region. */ function theme_blocks($region) { + global $theme; + $output = ''; + $content = drupal_get_content(); if ($list = module_invoke('block', 'list', $region)) { foreach ($list as $key => $block) { // $key == module_delta - $output .= theme('block', $block); + $output .= $block->themed ? theme('block', $block) : $block->content; } } + + $regions = system_region_list($theme); + + // If this is the default region, load any content assigned to regions not available in the current theme. + if ($region == variable_get('default_region', 'left')) { + foreach (system_region_list() as $key => $value) { + // Set content if it is not in one of the regions in the current theme. + if (!array_key_exists($key, $regions)) { + // Because this is a recursive call, it will include any drupal_set_content() assigned data. + $output .= theme('blocks', $key); + } + } + } + // Add any content assigned to this region through drupal_set_content() calls. + if (array_key_exists($region, $content)) { + $output .= $content[$region]; + } return $output; } Index: modules/block.module =================================================================== RCS file: /cvs/drupal/drupal/modules/block.module,v retrieving revision 1.172 diff -u -r1.172 block.module --- modules/block.module 29 Jun 2005 19:53:14 -0000 1.172 +++ modules/block.module 1 Jul 2005 22:59:53 -0000 @@ -14,7 +14,7 @@ case 'admin/help#block': return t('
Blocks are the boxes visible in the sidebar(s) of your web site. These are usually generated automatically by modules (e.g. recent forum topics), but you can also create your own blocks.
-The sidebar each block appears in depends on both which theme you are using (some are left-only, some right, some both), and on the settings in block management.
+The region each block appears in depends on both which theme you are using (some are left-only, some right, some both, and some may offer other regions), and on the settings in block management.
The block management screen lets you specify the vertical sort-order of the blocks within a sidebar. You do this by assigning a weight to each block. Lighter blocks (smaller weight) "float up" towards the top of the sidebar. Heavier ones "sink down" towards the bottom of it.
A block\'s visibility depends on:
Blocks are the boxes in the left and right side bars of the web site. They are made available by modules or created manually.
-Only enabled blocks are shown. You can position the blocks by deciding which side of the page they will show up on (sidebar) and in which order they appear (weight).
+Blocks are content rendered into regions, often boxes in the left and right side bars of the web site. They are made available by modules or created manually.
+Only enabled blocks are shown. You can position the blocks by deciding which area of the page they will show up on (e.g., a sidebar) and in which order they appear (weight).
If you want certain blocks to disable themselves temporarily during high server loads, check the 'Throttle' box. You can configure the auto-throttle on the throttle configuration page after having enabled the throttle module.
", array('%throttle' => url('admin/settings/throttle'))); case 'admin/block/add': @@ -105,6 +105,7 @@ $block = db_fetch_object(db_query('SELECT * FROM {boxes} WHERE bid = %d', $delta)); $data['subject'] = check_plain($block->title); $data['content'] = check_output($block->body, $block->format, FALSE); + $data['themed'] = $block->themed; return $data; } } @@ -112,7 +113,7 @@ function block_admin_save($edit) { foreach ($edit as $module => $blocks) { foreach ($blocks as $delta => $block) { - db_query("UPDATE {blocks} SET region = %d, status = %d, weight = %d, throttle = %d WHERE module = '%s' AND delta = '%s'", + db_query("UPDATE {blocks} SET region = '%s', status = %d, weight = %d, throttle = %d WHERE module = '%s' AND delta = '%s'", $block['region'], $block['status'], $block['weight'], $block['throttle'], $module, $delta); } } @@ -142,24 +143,31 @@ foreach ($module_blocks as $delta => $block) { $block['module'] = $module; $block['delta'] = $delta; + // If previously written to database, load values. if ($old_blocks[$module][$delta]) { $block['status'] = $old_blocks[$module][$delta]->status; $block['weight'] = $old_blocks[$module][$delta]->weight; $block['region'] = $old_blocks[$module][$delta]->region; + $block['themed'] = $old_blocks[$module][$delta]->themed; $block['visibility'] = $old_blocks[$module][$delta]->visibility; $block['pages'] = $old_blocks[$module][$delta]->pages; $block['custom'] = $old_blocks[$module][$delta]->custom; $block['throttle'] = $old_blocks[$module][$delta]->throttle; } + // Otherwise, use any set values, or else substitute defaults. else { - $block['status'] = $block['weight'] = $block['region'] = $block['custom'] = 0; - $block['pages'] = ''; + $properties = array ('status' => 0, 'weight' => 0, 'region' => 'left', 'themed' => 1, 'pages' => '', 'custom' => 0); + foreach ($properties as $property => $default) { + if (!isset ($block[$property])) { + $block[$property] = $default; + } + } } // reinsert blocks into table - db_query("INSERT INTO {blocks} (module, delta, status, weight, region, visibility, pages, custom, throttle) VALUES ('%s', '%s', %d, %d, %d, %d, '%s', %d, %d)", - $block['module'], $block['delta'], $block['status'], $block['weight'], $block['region'], $block['visibility'], $block['pages'], $block['custom'], $block['throttle']); + db_query("INSERT INTO {blocks} (module, delta, status, weight, region, themed, visibility, pages, custom, throttle) VALUES ('%s', '%s', %d, %d, '%s', %d, %d, '%s', %d, %d)", + $block['module'], $block['delta'], $block['status'], $block['weight'], $block['region'], $block['themed'], $block['visibility'], $block['pages'], $block['custom'], $block['throttle']); $blocks[] = $block; // build array to sort on @@ -180,15 +188,16 @@ function block_admin_display() { $blocks = _block_rehash(); - $header = array(t('Block'), t('Enabled'), t('Weight'), t('Sidebar')); + $header = array(t('Block'), t('Enabled'), t('Weight'), t('Placement')); if (module_exist('throttle')) { $header[] = t('Throttle'); } $header[] = array('data' => t('Operations'), 'colspan' => 2); - $left = array(); - $right = array(); + $regions = array(); $disabled = array(); + $block_regions = system_region_list(null, true); + foreach ($blocks as $block) { if ($block['module'] == 'block') { $delete = l(t('delete'), 'admin/block/delete/'. $block['delta']); @@ -200,8 +209,8 @@ $row = array(array('data' => $block['info'], 'class' => 'block'), form_checkbox(NULL, $block['module'] .']['. $block['delta'] .'][status', 1, $block['status']), form_weight(NULL, $block['module'] .']['. $block['delta'] .'][weight', $block['weight']), - form_radios(NULL, $block['module'] .']['. $block['delta'] .'][region', $block['region'], - array(t('left'), t('right')))); + form_select(NULL, $block['module'] .']['. $block['delta'] .'][region', isset($block['region']) ? $block['region'] : variable_get('default_region', 'left'), + $block_regions)); if (module_exist('throttle')) { $row[] = form_checkbox(NULL, $block['module'] .']['. $block['delta'] .'][throttle', 1, $block['throttle']); @@ -209,11 +218,10 @@ $row[] = l(t('configure'), 'admin/block/configure/'. $block['module'] .'/'. $block['delta']); $row[] = $delete; if ($block['status']) { - if ($block['region'] == 0) { - $left[] = $row; - } - if ($block['region'] == 1) { - $right[] = $row; + foreach ($block_regions as $key => $value) { + if ($block['region'] == $key) { + $regions[$key][] = $row; + } } } else if ($block['region'] <= 1) { @@ -222,19 +230,33 @@ } $rows = array(); - if (count($left)) { - $rows[] = array(array('data' => t('Left sidebar'), 'class' => 'region', 'colspan' => (module_exist('throttle') ? 7 : 6))); - $rows = array_merge($rows, $left); - } - if (count($right)) { - $rows[] = array(array('data' => t('Right sidebar'), 'class' => 'region', 'colspan' => (module_exist('throttle') ? 7 : 6))); - $rows = array_merge($rows, $right); + + if (count($regions)) { + foreach ($regions as $region => $row) { + // If the selected region is not one of the defined regions for the default theme's engine, asterix it. + $region_title = t('%region', array ('%region' => ucfirst($block_regions[$region]))); + $rows[] = array(array('data' => $region_title, 'class' => 'region', 'colspan' => (module_exist('throttle') ? 7 : 6))); + $rows = array_merge($rows, $row); + } } if (count($disabled)) { $rows[] = array(array('data' => t('Disabled'), 'class' => 'region', 'colspan' => (module_exist('throttle') ? 7 : 6))); $rows = array_merge($rows, $disabled); } $output = theme('table', $header, $rows, array('id' => 'blocks')); + + $non_default_region_message = false; + + // Test if asterix was added (therefore, if message will need to be displayed). + foreach ($block_regions as $region) { + if (substr ($region, strlen($region) - 1, 1) == '*') { + $non_default_region_message = true; + break; + } + } + if ($non_default_region_message) { + $output .= '' . t('* This region is not available in the default theme, so any blocks assigned to it will be assigned to the default region, %region.', array('%region' => $block_regions[variable_get('default_region', 'left')])) . '
'; + } $output .= form_submit(t('Save blocks')); return form($output, 'post', url('admin/block')); @@ -341,7 +363,7 @@ $output .= filter_form('format', $edit['format']); $output .= form_textarea(t('Block body'), 'body', $edit['body'], 60, 15, t('The content of the block as shown to the user.')); $output .= form_textfield(t('Block description'), 'info', $edit['info'], 60, 64, t('A brief description of your block. Used on the block overview page.', array('%overview' => url('admin/block')))); - + $output .= form_checkbox(t('Themed'), 'themed', 1, isset($edit['themed']) ? $edit['themed'] : 1, t('Check to have your block displayed using the block theming. Uncheck to have the block content written directly without being themed. Note that if uncheck this option, the block title will not be output.')); return $output; } @@ -351,14 +373,14 @@ } if (isset($delta)) { - db_query("UPDATE {boxes} SET title = '%s', body = '%s', info = '%s', format = %d WHERE bid = %d", $edit['title'], $edit['body'], $edit['info'], $edit['format'], $delta); + db_query("UPDATE {boxes} SET title = '%s', body = '%s', info = '%s', format = %d, themed = %d WHERE bid = %d", $edit['title'], $edit['body'], $edit['info'], $edit['format'], $edit['themed'], $delta); } else { if (empty($edit['info']) || db_num_rows(db_query("SELECT info FROM {boxes} WHERE info = '%s'", $edit['info']))) { form_set_error('title', t('Please ensure each block description is unique.')); return false; } - db_query("INSERT INTO {boxes} (title, body, info, format) VALUES ('%s', '%s', '%s', %d)", $edit['title'], $edit['body'], $edit['info'], $edit['format']); + db_query("INSERT INTO {boxes} (title, body, info, format, themed) VALUES ('%s', '%s', '%s', %d, %d)", $edit['title'], $edit['body'], $edit['info'], $edit['format'], $edit['themed']); } return true; } @@ -412,39 +434,36 @@ } } - /** - * Return all blocks in the specied region for the current user. You may - * use this function to implement variable block regions. The default - * regions are 'left', 'right' and 'all', where 'all' means both left and - * right. - * - * @param $region - * This is a string which describes in a human readable form which region - * you need. - * - * @param $regions - * This is an optional array and contains map(s) from the string $region to - * the numerical region value(s) in the blocks table. See default value for - * examples. - * - * @return - * An array of block objects, indexed with module_delta. - * If you are displaying your blocks in one or two sidebars, you may check - * whether this array is empty to see how many columns are going to be - * displayed. - * - * @todo - * Add a proper primary key (bid) to the blocks table so we don't have - * to mess around with this module_delta construct. - * Currently, the blocks table has no primary key defined! - */ -function block_list($region, $regions = array('left' => 0, 'right' => 1, 'all' => '0, 1')) { +/** + * Return all blocks in the specified region for the current user. + * + * @param $region + * This is a string which describes in a human readable form which region + * you need. + * + * @param $regions + * This is an optional array and contains map(s) from the string $region to + * the numerical region value(s) in the blocks table. + * + * @return + * An array of block objects, indexed with module_delta. + * If you are displaying your blocks in one or two sidebars, you may check + * whether this array is empty to see how many columns are going to be + * displayed. + * + * @todo + * Add a proper primary key (bid) to the blocks table so we don't have + * to mess around with this module_delta construct. + * Currently, the blocks table has no primary key defined! + */ +function block_list($region) { global $user; + static $blocks = array(); if (!isset($blocks[$region])) { $blocks[$region] = array(); - $result = db_query("SELECT * FROM {blocks} WHERE status = 1 AND region IN ('%s') ORDER BY weight, module", $regions[$region]); + $result = db_query("SELECT * FROM {blocks} WHERE status = 1 AND region = '%s' ORDER BY weight, module", $region); while ($block = db_fetch_array($result)) { // Use the user's block visibility setting, if necessary if ($block['custom'] != 0) { Index: modules/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system.module,v retrieving revision 1.216 diff -u -r1.216 system.module --- modules/system.module 27 Jun 2005 18:33:33 -0000 1.216 +++ modules/system.module 2 Jul 2005 19:09:03 -0000 @@ -193,6 +193,7 @@ $group .= form_textarea(t('Footer message'), 'site_footer', variable_get('site_footer', ''), 60, 5, t('This text will be displayed at the bottom of each page. Useful for adding a copyright notice to your pages.')); $group .= form_textfield(t('Anonymous user'), 'anonymous', variable_get('anonymous', 'Anonymous'), 60, 70, t('The name used to indicate anonymous users.')); $group .= form_textfield(t('Default front page'), 'site_frontpage', variable_get('site_frontpage', 'node'), 60, 70, t('The home page displays content from this relative URL. If you are not using clean URLs, specify the part after "?q=". If unsure, specify "node".')); + $group .= form_select(t('Default region'), 'default_region', variable_get('default_region', 'left'), array_merge(array('0' => '?q=
in the URL). You\'ll need ModRewrite
support for this to work. See the .htaccess
file in Drupal\'s top-level directory for more information.'));
@@ -312,6 +313,7 @@
drupal_load('theme', $themes[$key]->name);
$themes[$key]->owner = $themes[$key]->filename;
$themes[$key]->prefix = $key;
+ $themes[$key]->regions = function_exists($key . '_regions') ? call_user_func($key . '_regions') : array();
}
// Remove all theme engines from the system table
@@ -323,17 +325,27 @@
drupal_load('theme_engine', $engine->name);
db_query("INSERT INTO {system} (name, type, filename, status, throttle, bootstrap) VALUES ('%s', '%s', '%s', %d, %d, %d)", $engine->name, 'theme_engine', $engine->filename, 1, 0, 0);
+ // Load engine's regions
+ $engine->regions = function_exists($engine->name . '_regions') ? call_user_func($engine->name . '_regions') : array();
+
// Add templates to the site listing
foreach (call_user_func($engine->name . '_templates') as $template) {
- $template->template = TRUE;
- $template->name = basename(dirname($template->filename));
- $template->owner = $engine->filename;
- $template->prefix = $engine->name;
- // do not double-insert templates with theme files in their directory
+ // Do not double-insert templates with theme files in their directory,
+ // but do register their engine data.
if (array_key_exists($template->name, $themes)) {
+ $themes[$template->name]->owner = $engine->filename;
+ $themes[$template->name]->prefix = $engine->name;
+ $themes[$template->name]->regions = array_merge($themes[$template->name]->regions, $engine->regions);
continue;
}
- $themes[$template->name] = $template;
+ else {
+ $template->template = TRUE;
+ $template->name = basename(dirname($template->filename));
+ $template->owner = $engine->filename;
+ $template->prefix = $engine->name;
+ $template->regions = $engine->regions;
+ $themes[$template->name] = $template;
+ }
}
}
@@ -345,6 +357,7 @@
$style->name = basename(dirname($style->filename));
$style->owner = $theme->filename;
$style->prefix = $theme->template ? $theme->prefix : $theme->name;
+ $style->regions = array();
// do not double-insert styles with theme files in their directory
if (array_key_exists($style->name, $themes)) {
continue;
@@ -366,6 +379,71 @@
}
/**
+ * Get a list of all defined regions.
+ *
+ * @param $theme_key
+ * The name of a theme. If none is set, regions from all themes are loaded.
+ * @param $mark_nondefault
+ * Boolean indicating if regions not available in the current theme should be
+ * asterixed.
+ * @param $scope
+ * Subset of regions to be loaded. Options are 'all', for all regions, and
+ * 'core' for only those regions available in all themes.
+ * @return
+ * An array of all regions.
+ */
+function system_region_list($theme_key = null, $mark_nondefault = false, $scope = 'all') {
+ global $theme, $theme_engine;
+
+ // Load any module-defined regions.
+ $regions = module_invoke_all('regions');
+ if (!$theme || !$theme_engine) {
+ $theme = init_theme();
+ }
+
+ $themes = system_theme_data();
+
+ // Load default theme's regions.
+ $regions = array_merge($regions, $themes[$theme]->regions);
+ if($theme_key) {
+ $regions = array_merge($regions, $themes[$theme_key]->regions);
+ }
+ else {
+ foreach ($themes as $info) {
+ if (!$info->style) {
+ switch ($scope) {
+ case 'all':
+ $regions = array_merge($regions, $info->regions);
+ break;
+ case 'core':
+ $regions = array_intersect($regions, $info->regions);
+ break;
+ }
+ }
+ }
+ // Ensure default theme's region titles override other titles.
+ switch ($scope) {
+ case 'all':
+ $regions = array_merge($regions, $themes[$theme]->regions);
+ break;
+ case 'core':
+ $regions = array_intersect($themes[$theme]->regions, $regions);
+ break;
+ }
+
+ if (($scope != 'core') && $mark_nondefault) {
+ foreach ($regions as $key => $value) {
+ // If the selected region is not one of the defined regions for the default theme, asterix it.
+ if (!array_key_exists ($key, $themes[$theme]->regions)) {
+ $regions[$key] .= '*';
+ }
+ }
+ }
+ }
+ return $regions;
+}
+
+/**
* Returns an array of files objects of the given type from both the
* site-wide directory (i.e. modules/) and site-specific directory
* (i.e. sites/somesite/modules/). The returned array will be keyed
Index: themes/chameleon/chameleon.theme
===================================================================
RCS file: /cvs/drupal/drupal/themes/chameleon/chameleon.theme,v
retrieving revision 1.30
diff -u -r1.30 chameleon.theme
--- themes/chameleon/chameleon.theme 6 Jun 2005 14:07:04 -0000 1.30
+++ themes/chameleon/chameleon.theme 2 Jul 2005 18:29:07 -0000
@@ -16,6 +16,13 @@
'toggle_secondary_links');
}
+function chameleon_regions() {
+ return array(
+ 'left' => t('left sidebar'),
+ 'right' => t('right sidebar')
+ );
+}
+
function chameleon_page($content) {
$language = $GLOBALS['locale'];
Index: themes/engines/phptemplate/phptemplate.engine
===================================================================
RCS file: /cvs/drupal/drupal/themes/engines/phptemplate/phptemplate.engine,v
retrieving revision 1.4
diff -u -r1.4 phptemplate.engine
--- themes/engines/phptemplate/phptemplate.engine 25 May 2005 06:03:18 -0000 1.4
+++ themes/engines/phptemplate/phptemplate.engine 2 Jul 2005 19:16:57 -0000
@@ -17,6 +17,19 @@
return system_listing('^page\.tpl\.php$', $directory, 'filename');
}
+function phptemplate_regions() {
+ return array(
+ 'left' => t('left sidebar'),
+ 'right' => t('right sidebar'),
+ 'messages' => t('messages'),
+ 'help' => t('help'),
+ 'content' => t('content'),
+ 'right' => t('right sidebar'),
+ 'footer' => t('footer'),
+ 'closure' => t('closure')
+ );
+}
+
/**
* Execute a template engine call.
*
@@ -68,6 +81,7 @@
* A sequential array of variables passed to the theme function.
*/
function _phptemplate_default_variables($hook, $variables) {
+ global $theme;
static $count = array();
$count[$hook] = is_int($count[$hook]) ? $count[$hook] : 1;
$variables['zebra'] = ($count[$hook] % 2) ? 'odd' : 'even';
@@ -79,7 +93,19 @@
$variables['block_zebra'] = ($count['block_counter'][$sidebar_indicator] % 2) ? 'odd' : 'even';
$variables['block_id'] = $count['block_counter'][$sidebar_indicator]++;
}
-
+ elseif ($hook == 'page') {
+ $regions = system_region_list($theme);
+ // Load all region content assigned via blocks.
+ foreach (system_region_list() as $region => $data) {
+ // If blocks in this region have already been loaded, don't reload them.
+ if (!in_array($region, array('left', 'right', 'footer'))) {
+ // If loaded region is present in current theme, set it.
+ if (array_key_exists($region, $regions)) {
+ $variables[$region] .= theme('blocks', $region);
+ }
+ }
+ }
+ }
// Tell all templates where they are located.
$variables['directory'] = path_to_theme();
@@ -168,7 +194,7 @@
'sidebar_left' => $sidebar_left,
'content' => '' . $content . '',
'sidebar_right' => $sidebar_right,
- 'footer_message' => variable_get('site_footer', FALSE),
+ 'footer_message' => variable_get('site_footer', FALSE) . "\n" . theme('blocks', 'footer'),
'closure' => theme('closure')
);
if ((arg(0) == 'node') && is_int(arg(1))) {