? .DS_Store ? document-menu_get_object-arg-better.patch ? drupal_render.patch ? install_text_fixes.patch ? kick-comment-rendering-node-module.patch ? mw_235.patch ? mw_239.patch ? style-fixes-node-content-type.patch ? variable_rendering.patch ? sites/.DS_Store ? sites/default/.DS_Store ? sites/default/files ? sites/default/settings.php ? themes/.DS_Store Index: index.php =================================================================== RCS file: /cvs/drupal/drupal/index.php,v retrieving revision 1.96 diff -u -p -r1.96 index.php --- index.php 20 Sep 2008 20:22:23 -0000 1.96 +++ index.php 31 Dec 2008 23:41:17 -0000 @@ -35,6 +35,10 @@ if (is_int($return)) { break; } } +elseif (is_array($return)) { + // The preferred return value of a menu callback is an array. + print theme('page', drupal_render($return)); +} elseif (isset($return)) { // Print any value (including an empty string) except NULL or undefined: print theme('page', $return); Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.458 diff -u -p -r1.458 theme.inc --- includes/theme.inc 31 Dec 2008 12:02:21 -0000 1.458 +++ includes/theme.inc 31 Dec 2008 23:41:18 -0000 @@ -1977,8 +1977,9 @@ function template_preprocess_page(&$vari * @see node.tpl.php */ function template_preprocess_node(&$variables) { - $node = $variables['node']; - + // For convenience, alias several variables to as top level elements. + $node = $variables['node'] = &$variables['elements']['node']; + $variables['teaser'] = &$variables['elements']['teaser']; $variables['date'] = format_date($node->created); $variables['name'] = theme('username', $node); $variables['node_url'] = url('node/' . $node->nid); Index: modules/node/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.module,v retrieving revision 1.1008 diff -u -p -r1.1008 node.module --- modules/node/node.module 31 Dec 2008 12:02:22 -0000 1.1008 +++ modules/node/node.module 31 Dec 2008 23:41:18 -0000 @@ -96,7 +96,7 @@ function node_help($path, $arg) { function node_theme() { return array( 'node' => array( - 'arguments' => array('node' => NULL, 'teaser' => FALSE, 'page' => FALSE), + 'arguments' => array('elements' => NULL), 'template' => 'node', ), 'node_list' => array( @@ -1123,24 +1123,31 @@ function node_delete($nid) { } /** - * Generate a display of the given node. + * Generate an array for rendering the given node. * * @param $node * A node array or node object. * @param $teaser * Whether to display the teaser only or the full form. - * @param $links - * Whether or not to display node links. Links are omitted for node previews. + * @param $page + * Whether to display the teaser only or the full form. * * @return - * An HTML representation of the themed node. + * AnAn array as expected by drupal_render(). */ function node_view($node, $teaser = FALSE) { $node = (object)$node; $node = node_build_content($node, $teaser); - return theme('node', $node, $teaser); + $render = $node->content; + $render += array( + '#theme' => 'node', + 'node' => $node, + 'teaser' => $teaser, + ); + + return $render; } /** @@ -1878,14 +1885,20 @@ function node_page_default() { $nids = pager_query(db_rewrite_sql('SELECT n.nid FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC'), variable_get('default_nodes_main', 10))->fetchCol(); if (!empty($nids)) { $nodes = node_load_multiple($nids); - $output = ''; + $render = array(); + $weight = 0; foreach ($nodes as $node) { - $output .= node_view($node, TRUE); + $render["node_$node->nid"] = node_view($node, TRUE); + $render["node_$node->nid"]['#weight'] = $weight; + $weight++; } $feed_url = url('rss.xml', array('absolute' => TRUE)); drupal_add_feed($feed_url, variable_get('site_name', 'Drupal') . ' ' . t('RSS')); - $output .= theme('pager', NULL, variable_get('default_nodes_main', 10)); + $render['pager'] = array( + '#markup' => theme('pager', NULL, variable_get('default_nodes_main', 10)), + '#weight' => $weight, + ); } else { $default_message = '

' . t('Welcome to your new Drupal website!') . '

'; @@ -1898,11 +1911,15 @@ function node_page_default() { $default_message .= ''; $default_message .= '

' . t('For more information, please refer to the help section, or the online Drupal handbooks. You may also post at the Drupal forum, or view the wide range of other support options available.', array('@help' => url('admin/help'), '@handbook' => 'http://drupal.org/handbooks', '@forum' => 'http://drupal.org/forum', '@support' => 'http://drupal.org/support')) . '

'; - $output = '
' . $default_message . '
'; + $output = array( + '#markup' => $default_message, + '#prefix' => '
', + '#suffix' => '
' + ); } drupal_set_title(''); - return $output; + return $render; } /**