? .completion.db ? .git ? block_render_cleanup.patch ? drupal_render_cache.php ? drushrc.php ? prepare_page.patch.SAVE ? tmp.sql ? includes/cache.peruser.inc ? modules/comment/comment-node-type-form.js ? modules/node/node.diff.inc ? modules/node/node.pages-diff.inc ? modules/simpletest/tests/hook_url_rewrite.info ? modules/simpletest/tests/hook_url_rewrite.module ? modules/simpletest/tests/path.test Index: modules/block/block.module =================================================================== RCS file: /cvs/drupal/drupal/modules/block/block.module,v retrieving revision 1.341 diff -u -F^f -p -r1.341 block.module --- modules/block/block.module 31 May 2009 07:46:54 -0000 1.341 +++ modules/block/block.module 1 Jun 2009 14:21:30 -0000 @@ -93,7 +93,7 @@ function block_help($path, $arg) { function block_theme() { return array( 'block' => array( - 'arguments' => array('block' => NULL), + 'arguments' => array('elements' => NULL), 'template' => 'block', ), 'block_admin_display_form' => array( @@ -244,14 +244,17 @@ function block_page_alter($page) { if (!empty($page['#show_blocks']) || ($region != 'left' && $region != 'right')) { // Assign blocks to region. if ($blocks = block_get_blocks_by_region($region)) { - $page[$region]['blocks'] = $blocks; + $page[$region] = $blocks; } // Append region description if we are rendering the block admin page. $item = menu_get_item(); if ($item['path'] == 'admin/build/block') { $description = '
' . $regions[$region] . '
'; - $page[$region]['blocks']['block_description'] = array('#markup' => $description); + $page[$region]['block_description'] = array( + '#markup' => $description, + '#weight' => 10, + ); } } } @@ -268,8 +271,10 @@ function block_get_blocks_by_region($reg $build = array(); if ($list = block_list($region)) { foreach ($list as $key => $block) { - $build[$key] = array( - '#theme' => 'block', + $build[$key] = $block->content; + unset($block->content); + $build[$key] += array( + '#theme_wrapper' => 'block', '#block' => $block, '#weight' => ++$weight, ); @@ -676,13 +681,17 @@ function _block_render_blocks($region_bl cache_set($cid, $array, 'cache_block', CACHE_TEMPORARY); } } - + if (isset($array) && is_array($array)) { foreach ($array as $k => $v) { $block->$k = $v; } } if (isset($block->content) && $block->content) { + // Normalize to the drupal_render() structure. + if (is_string($block->content)) { + $block->content = array('content' => array('#markup' => $block->content)); + } // Override default block title if a custom display title is present. if ($block->title) { // Check plain here to allow module generated titles to keep any markup. @@ -777,7 +786,7 @@ function block_flush_caches() { */ function template_preprocess_block(&$variables) { static $block_counter = array(); - $variables['block'] = $variables['block']['#block']; + $variables['block'] = $variables['elements']['#block']; // All blocks get an independent counter for each region. if (!isset($block_counter[$variables['block']->region])) { $block_counter[$variables['block']->region] = 1; @@ -786,10 +795,8 @@ 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); - } + // Create the $content variable that templates expect. + $variables['block']->content = $variables['elements']['#children']; $variables['classes_array'][] = 'block-' . $variables['block']->module;