? .cvsignore ? drbm.tmproj ? mail.patch ? nbproject ? tmp.patch ? tmp.patch.patch ? value_callback.patch ? modules/node/node-admin-display-overview-form.tpl.php ? modules/node/node.build_mode.inc ? sites/all/modules ? sites/default/files Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.856 diff -u -F^f -p -r1.856 common.inc --- includes/common.inc 23 Jan 2009 14:23:27 -0000 1.856 +++ includes/common.inc 25 Jan 2009 05:26:06 -0000 @@ -3283,6 +3283,10 @@ function drupal_render(&$elements) { // Until now, we rendered the children, here we render the element itself if (!isset($elements['#printed'])) { + if (isset($elements['#value_callback']) && drupal_function_exists($elements['#value_callback'])) { + $function = $elements['#value_callback']; + $elements['#markup'] = $function($elements); + } $content = theme(!empty($elements['#type']) ? $elements['#type'] : 'markup', $elements); $elements['#printed'] = TRUE; } Index: modules/comment/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v retrieving revision 1.686 diff -u -F^f -p -r1.686 comment.module --- modules/comment/comment.module 23 Jan 2009 14:23:27 -0000 1.686 +++ modules/comment/comment.module 25 Jan 2009 05:26:07 -0000 @@ -495,12 +495,12 @@ function comment_nodeapi_view($node, $te ); // Append the list of comments to $node->content for node detail pages. - if ($node->comment && (bool)menu_get_object() && $node->build_mode != NODE_BUILD_PREVIEW) { - $node->content['comments'] = array( - '#markup' => comment_render($node), - '#sorted' => TRUE, - ); - } + $node->content['comments'] = array( + '#value_callback' => 'comment_render', + '#access' => $node->comment && (bool)menu_get_object() && $node->build_mode != NODE_BUILD_PREVIEW, + '#node' => $node, + '#sorted' => TRUE, + ); } } @@ -985,8 +985,9 @@ function comment_links($comment, $return /** * Renders comment(s). * - * @param $node - * The node which comment(s) needs rendering. + * @param $elements + * A renderable array. + * * @param $cid * Optional, if given, only one comment is rendered. * @@ -1044,9 +1045,10 @@ function comment_links($comment, $return * spoil the reverse ordering, "ORDER BY thread ASC" -- here, we do not need * to consider the trailing "/" so we use a substring only. */ -function comment_render($node, $cid = 0) { +function comment_render($elements, $cid = 0) { global $user; $output = ''; + $node = $elements['#node']; if (user_access('access comments')) { // Pre-process variables.