Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.892 diff -u -p -r1.892 common.inc --- includes/common.inc 4 May 2009 10:38:47 -0000 1.892 +++ includes/common.inc 4 May 2009 12:43:38 -0000 @@ -3267,8 +3267,7 @@ 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); return $page; } Index: modules/block/block.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/block/block.admin.inc,v retrieving revision 1.36 diff -u -p -r1.36 block.admin.inc --- modules/block/block.admin.inc 26 Apr 2009 16:30:28 -0000 1.36 +++ modules/block/block.admin.inc 4 May 2009 12:43:38 -0000 @@ -36,6 +36,9 @@ function block_admin_display_form(&$form $block_regions = system_region_list($theme_key) + array(BLOCK_REGION_NONE => '<' . t('none') . '>'); + // Use form submission data to show values if showing the form again. + $blocks = (!empty($form_state['values']) ? $form_state['values'] : $blocks); + // Weights range from -delta to +delta, so delta should be at least half // of the amount of blocks present. This makes sure all blocks in the same // region get an unique weight. @@ -95,6 +98,19 @@ function block_admin_display_form(&$form } /** + * Validate main blocks administration form submissions. + */ +function block_admin_display_form_validate($form, &$form_state) { + foreach ($form_state['values'] as $key => $block) { + if (($block['module'] == 'system') && ($block['delta'] == 'main') && ($block['region'] == BLOCK_REGION_NONE)) { + form_set_error($key, t('Disabling the main page content block makes your system unusable. You should always enable it to display in a region.')); + // Suggest to put it back into the content region. + $form_state['values'][$key]['region'] = 'content'; + } + } +} + +/** * Process main blocks administration form submissions. */ function block_admin_display_form_submit($form, &$form_state) { Index: modules/block/block.module =================================================================== RCS file: /cvs/drupal/drupal/modules/block/block.module,v retrieving revision 1.329 diff -u -p -r1.329 block.module --- modules/block/block.module 26 Apr 2009 16:30:28 -0000 1.329 +++ modules/block/block.module 4 May 2009 12:43:38 -0000 @@ -761,6 +761,11 @@ function template_preprocess_block(&$var $variables['block_zebra'] = ($block_counter[$variables['block']->region] % 2) ? 'odd' : 'even'; $variables['block_id'] = $block_counter[$variables['block']->region]++; + if (is_array($variables['block']->content)) { + // Render the block contents if it is not already rendered. + $variables['block']->content = drupal_render($variables['block']->content); + } + $variables['template_files'][] = 'block-' . $variables['block']->region; $variables['template_files'][] = 'block-' . $variables['block']->module; $variables['template_files'][] = 'block-' . $variables['block']->module . '-' . $variables['block']->delta; Index: modules/system/system.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v retrieving revision 1.140 diff -u -p -r1.140 system.admin.inc --- modules/system/system.admin.inc 3 May 2009 07:35:37 -0000 1.140 +++ modules/system/system.admin.inc 4 May 2009 12:43:38 -0000 @@ -179,7 +179,9 @@ function system_themes_form() { } else { // Ensure this theme is compatible with this version of core. - if (!isset($theme->info['core']) || $theme->info['core'] != DRUPAL_CORE_COMPATIBILITY) { + // Require the 'content' region to make sure the main page + // content has a common place in all themes. + if (!isset($theme->info['core']) || ($theme->info['core'] != DRUPAL_CORE_COMPATIBILITY) || (!isset($theme->info['regions']['content']))) { $incompatible_core[] = $theme->name; } if (version_compare(phpversion(), $theme->info['php']) < 0) { Index: modules/system/system.install =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.install,v retrieving revision 1.319 diff -u -p -r1.319 system.install --- modules/system/system.install 30 Apr 2009 21:44:18 -0000 1.319 +++ modules/system/system.install 4 May 2009 12:43:38 -0000 @@ -3255,7 +3255,7 @@ function system_update_7020() { } /** - * Add help block to the help region, migrate custom variables to blocks. + * Add new blocks to new region, migrate custom variables to blocks. */ function system_update_7021() { $ret = array(); @@ -3267,6 +3267,8 @@ function system_update_7021() { $themes_with_blocks[] = $theme->name; // Add new system generated help block. $ret[] = update_sql("INSERT INTO {block} (module, delta, theme, status, weight, region, pages, cache) VALUES ('system', 'help', '" . $theme->name . "', 1, 0, 'help', '', 1)"); + // Add new system generated main page content block. + $ret[] = update_sql("INSERT INTO {block} (module, delta, theme, status, weight, region, pages, cache) VALUES ('system', 'main', '" . $theme->name . "', 1, 0, 'content', '', -1)"); } // Migrate contact form information and user register help to blocks. Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.689 diff -u -p -r1.689 system.module --- modules/system/system.module 30 Apr 2009 21:44:19 -0000 1.689 +++ modules/system/system.module 4 May 2009 12:43:38 -0000 @@ -889,6 +889,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', @@ -957,6 +962,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'; $block['subject'] = NULL; @@ -979,6 +988,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) { + $content_block = &drupal_static(__FUNCTION__, NULL); + if (!empty($content)) { + $content_block = (is_array($content) ? $content : array('main' => array('#markup' => $content))); + } + else { + return $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.41 diff -u -p -r1.41 default.profile --- profiles/default/default.profile 30 Apr 2009 21:44:20 -0000 1.41 +++ profiles/default/default.profile 4 May 2009 12:43:38 -0000 @@ -91,9 +91,19 @@ function default_profile_task_list() { */ function default_profile_tasks(&$task, $url) { - // Enable 5 standard blocks. + // Enable some standard blocks. $values = array( array( + 'module' => 'system', + 'delta' => 'main', + 'theme' => 'garland', + 'status' => 1, + 'weight' => 0, + 'region' => 'content', + 'pages' => '', + 'cache' => -1, + ), + array( 'module' => 'user', 'delta' => 'login', 'theme' => 'garland', Index: profiles/expert/expert.profile =================================================================== RCS file: /cvs/drupal/drupal/profiles/expert/expert.profile,v retrieving revision 1.7 diff -u -p -r1.7 expert.profile --- profiles/expert/expert.profile 30 Apr 2009 21:44:20 -0000 1.7 +++ profiles/expert/expert.profile 4 May 2009 12:43:38 -0000 @@ -42,9 +42,20 @@ function expert_profile_task_list() { * Perform any final installation tasks for this profile. */ function expert_profile_tasks(&$task, $url) { - // Enable 4 standard blocks. + + // Enable some standard blocks. $values = array( array( + 'module' => 'system', + 'delta' => 'main', + 'theme' => 'garland', + 'status' => 1, + 'weight' => 0, + 'region' => 'content', + 'pages' => '', + 'cache' => -1, + ), + array( 'module' => 'user', 'delta' => 'login', 'theme' => 'garland',