From 2ecc273c60f3b625fe3b44005813e73eba5ea57a Mon Sep 17 00:00:00 2001 From: webchick Date: Sun, 26 Jun 2011 23:11:35 -0700 Subject: Issue #253725 by jhodgdon: Fixed () in search results does not have array keys on comments and uploads values. --- modules/comment/comment.module | 2 +- modules/node/node.api.php | 12 +++++++++--- modules/search/search-result.tpl.php | 2 -- 3 files changed, 10 insertions(+), 6 deletions(-) (limited to 'modules') diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 0381fac7d..8d0c3d362 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -1369,7 +1369,7 @@ function comment_node_search_result($node) { // Do not make a string if comments are closed and there are currently // zero comments. if ($node->comment != COMMENT_NODE_CLOSED || $comments > 0) { - return format_plural($comments, '1 comment', '@count comments'); + return array('comment' => format_plural($comments, '1 comment', '@count comments')); } } } diff --git a/modules/node/node.api.php b/modules/node/node.api.php index d7a98c6fb..90ffd8b7f 100644 --- a/modules/node/node.api.php +++ b/modules/node/node.api.php @@ -642,14 +642,20 @@ function hook_node_prepare($node) { * @param $node * The node being displayed in a search result. * - * @return - * Extra information to be displayed with search result. + * @return array + * Extra information to be displayed with search result. This information + * should be presented as an associative array. It will be concatenated + * with the post information (last updated, author) in the default search + * result theming. + * + * @see template_preprocess_search_result() + * @see search-result.tpl.php * * @ingroup node_api_hooks */ function hook_node_search_result($node) { $comments = db_query('SELECT comment_count FROM {node_comment_statistics} WHERE nid = :nid', array('nid' => $node->nid))->fetchField(); - return format_plural($comments, '1 comment', '@count comments'); + return array('comment' => format_plural($comments, '1 comment', '@count comments')); } /** diff --git a/modules/search/search-result.tpl.php b/modules/search/search-result.tpl.php index 30b321fb2..db9f2202f 100644 --- a/modules/search/search-result.tpl.php +++ b/modules/search/search-result.tpl.php @@ -31,8 +31,6 @@ * - $info_split['date']: Last update of the node. Short formatted. * - $info_split['comment']: Number of comments output as "% comments", % * being the count. Depends on comment.module. - * - $info_split['upload']: Number of attachments output as "% attachments", % - * being the count. Depends on upload.module. * * Other variables: * - $classes_array: Array of HTML class attribute values. It is flattened -- cgit v1.2.3