Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.874 diff -u -p -r1.874 common.inc --- includes/common.inc 30 Mar 2009 05:13:45 -0000 1.874 +++ includes/common.inc 6 Apr 2009 13:04:35 -0000 @@ -3263,8 +3263,13 @@ function drupal_alter($type, &$data) { function drupal_get_page($content = NULL) { // Initialize page array with defaults. @see hook_elements() - 'page' element. $page = element_info('page'); - $page['content'] = is_array($content) ? $content : array('main' => array('#markup' => $content)); - + system_set_content_block($content); + + // UNCOMMENT this if you try this patch without re-installation. Then + // put the main content block into the content region and then comment + // this out again (or your content will be printed twice). + // $page['content'] = is_array($content) ? $content : array('main' => array('#markup' => $content)); + return $page; } Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.676 diff -u -p -r1.676 system.module --- modules/system/system.module 25 Mar 2009 18:40:50 -0000 1.676 +++ modules/system/system.module 6 Apr 2009 13:04:35 -0000 @@ -881,6 +881,11 @@ function system_user_timezone(&$edit, &$ * Implementation of hook_block_list(). */ function system_block_list() { + $blocks['main'] = array( + 'info' => t('Main page content'), + // Cached elsewhere. + 'cache' => BLOCK_NO_CACHE, + ); $blocks['powered-by'] = array( 'info' => t('Powered by Drupal'), 'weight' => '10', @@ -946,6 +951,10 @@ function system_block_save($delta = '', function system_block_view($delta = '') { $block = array(); switch ($delta) { + case 'main': + $block['subject'] = NULL; + $block['content'] = system_set_content_block(); + return $block; case 'powered-by': $image_path = 'misc/' . variable_get('drupal_badge_color', 'powered-blue') . '-' . variable_get('drupal_badge_size', '80x15') . '.png'; // Don't display a title. @@ -965,6 +974,23 @@ function system_block_view($delta = '') } /** + * Memory for the page content so that it can be put into a region as a block. + * + * Given the nature of the Drupal page handling, this will be called once with + * a string or array. We store that and return it later as the block is being + * displayed. + */ +function system_set_content_block($content = NULL) { + static $content_block; + if (isset($content)) { + $content_block = (is_array($content) ? $content : array('main' => array('#markup' => $content))); + } + else { + return drupal_render($content_block); + } +} + +/** * Provide a single block on the administration overview page. * * @param $item Index: profiles/default/default.profile =================================================================== RCS file: /cvs/drupal/drupal/profiles/default/default.profile,v retrieving revision 1.39 diff -u -p -r1.39 default.profile --- profiles/default/default.profile 20 Mar 2009 19:18:11 -0000 1.39 +++ profiles/default/default.profile 6 Apr 2009 13:04:35 -0000 @@ -91,7 +91,8 @@ function default_profile_task_list() { */ function default_profile_tasks(&$task, $url) { - // Enable 4 standard blocks. + // Enable 5 standard blocks. + db_query("INSERT INTO {block} (module, delta, theme, status, weight, region, pages, cache) VALUES ('%s', '%s', '%s', %d, %d, '%s', '%s', %d)", 'system', 'main', 'garland', 1, 0, 'content', '', -1); db_query("INSERT INTO {block} (module, delta, theme, status, weight, region, pages, cache) VALUES ('%s', '%s', '%s', %d, %d, '%s', '%s', %d)", 'user', 'login', 'garland', 1, 0, 'left', '', -1); db_query("INSERT INTO {block} (module, delta, theme, status, weight, region, pages, cache) VALUES ('%s', '%s', '%s', %d, %d, '%s', '%s', %d)", 'system', 'navigation', 'garland', 1, 0, 'left', '', -1); db_query("INSERT INTO {block} (module, delta, theme, status, weight, region, pages, cache) VALUES ('%s', '%s', '%s', %d, %d, '%s', '%s', %d)", 'system', 'management', 'garland', 1, 1, 'left', '', -1); Index: profiles/expert/expert.profile =================================================================== RCS file: /cvs/drupal/drupal/profiles/expert/expert.profile,v retrieving revision 1.5 diff -u -p -r1.5 expert.profile --- profiles/expert/expert.profile 20 Mar 2009 19:18:11 -0000 1.5 +++ profiles/expert/expert.profile 6 Apr 2009 13:04:35 -0000 @@ -42,7 +42,8 @@ function expert_profile_task_list() { * Perform any final installation tasks for this profile. */ function expert_profile_tasks(&$task, $url) { - // Enable 3 standard blocks. + // Enable 4 standard blocks. + db_query("INSERT INTO {block} (module, delta, theme, status, weight, region, pages, cache) VALUES ('%s', '%s', '%s', %d, %d, '%s', '%s', %d)", 'system', 'main', 'garland', 1, 0, 'content', '', -1); db_query("INSERT INTO {block} (module, delta, theme, status, weight, region, pages, cache) VALUES ('%s', '%s', '%s', %d, %d, '%s', '%s', %d)", 'user', 'login', 'garland', 1, 0, 'left', '', -1); db_query("INSERT INTO {block} (module, delta, theme, status, weight, region, pages, cache) VALUES ('%s', '%s', '%s', %d, %d, '%s', '%s', %d)", 'system', 'navigation', 'garland', 1, 0, 'left', '', -1); db_query("INSERT INTO {block} (module, delta, theme, status, weight, region, pages, cache) VALUES ('%s', '%s', '%s', %d, %d, '%s', '%s', %d)", 'system', 'management', 'garland', 1, 1, 'left', '', -1);