Issue #253725 by jhodgdon: Fixed () in search results does not have array keys on comments and uploads values.

merge-requests/26/head
webchick 2011-06-26 23:11:35 -07:00
parent 67ff15fef1
commit 2ecc273c60
3 changed files with 10 additions and 6 deletions

View File

@ -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'));
}
}
}

View File

@ -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'));
}
/**

View File

@ -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