summaryrefslogtreecommitdiff
path: root/modules/comment/comment.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-10-09 01:00:08 +0000
committerDries Buytaert <dries@buytaert.net>2009-10-09 01:00:08 +0000
commitc05f2181dc8556cb6700e8c6bb6e6ded43273192 (patch)
tree5446facb7f5f18dfaac48aade56c0d86f1477fff /modules/comment/comment.module
parent48dd14a898420ae98984c951f59e8d299080bee8 (diff)
downloadbrdo-c05f2181dc8556cb6700e8c6bb6e6ded43273192.tar.gz
brdo-c05f2181dc8556cb6700e8c6bb6e6ded43273192.tar.bz2
- Patch #572618 by effulgentsia, pwolanin, sun: all theme functions should take a single argument. Code clean-up and performance improvement. Woot.
Diffstat (limited to 'modules/comment/comment.module')
-rw-r--r--modules/comment/comment.module29
1 files changed, 16 insertions, 13 deletions
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 8a8e43f94..a5f3a2999 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -142,7 +142,7 @@ function comment_theme() {
'arguments' => array('elements' => NULL),
),
'comment_post_forbidden' => array(
- 'arguments' => array('nid' => NULL),
+ 'arguments' => array('node' => NULL),
),
'comment_wrapper' => array(
'template' => 'comment-wrapper',
@@ -466,7 +466,7 @@ function theme_comment_block() {
}
if ($items) {
- return theme('item_list', $items);
+ return theme('item_list', array('items' => $items));
}
}
@@ -522,7 +522,7 @@ function comment_node_view($node, $build_mode) {
);
}
else {
- $links['comment_forbidden']['title'] = theme('comment_post_forbidden', $node);
+ $links['comment_forbidden']['title'] = theme('comment_post_forbidden', array('node' => $node));
}
}
}
@@ -547,7 +547,7 @@ function comment_node_view($node, $build_mode) {
}
}
else {
- $links['comment_forbidden']['title'] = theme('comment_post_forbidden', $node);
+ $links['comment_forbidden']['title'] = theme('comment_post_forbidden', array('node' => $node));
}
}
}
@@ -901,7 +901,7 @@ function comment_links($comment, $node) {
);
}
else {
- $links['comment_forbidden']['title'] = theme('comment_post_forbidden', $node);
+ $links['comment_forbidden']['title'] = theme('comment_post_forbidden', array('node' => $node));
$links['comment_forbidden']['html'] = TRUE;
}
}
@@ -1736,7 +1736,7 @@ function comment_form($form, &$form_state, $comment) {
$form['_author'] = array(
'#type' => 'item',
'#title' => t('Your name'),
- '#markup' => theme('username', $user),
+ '#markup' => theme('username', array('account' => $user)),
);
$form['author'] = array(
'#type' => 'value',
@@ -2093,19 +2093,19 @@ function template_preprocess_comment(&$variables) {
$node = $variables['elements']['#node'];
$variables['comment'] = $comment;
$variables['node'] = $node;
- $variables['author'] = theme('username', $comment);
+ $variables['author'] = theme('username', array('account' => $comment));
$variables['date'] = format_date($comment->timestamp);
$variables['new'] = !empty($comment->new) ? t('new') : '';
- $variables['picture'] = theme_get_setting('toggle_comment_user_picture') ? theme('user_picture', $comment) : '';
+ $variables['picture'] = theme_get_setting('toggle_comment_user_picture') ? theme('user_picture', array('account' => $comment)) : '';
$variables['signature'] = $comment->signature;
$variables['title'] = l($comment->subject, 'comment/' . $comment->cid, array('fragment' => "comment-$comment->cid"));
$variables['template_files'][] = 'comment-' . $variables['node']->type;
-
+
// Helpful $content variable for templates.
foreach (element_children($variables['elements']) as $key) {
$variables['content'][$key] = $variables['elements'][$key];
}
-
+
// Set status to a string representation of comment->status.
if (isset($comment->in_preview)) {
$variables['status'] = 'comment-preview';
@@ -2137,11 +2137,14 @@ function template_preprocess_comment(&$variables) {
/**
* Theme a "you can't post comments" notice.
*
- * @param $node
- * The comment node.
+ * @param $variables
+ * An associative array containing:
+ * - node: The comment node.
+ *
* @ingroup themeable
*/
-function theme_comment_post_forbidden($node) {
+function theme_comment_post_forbidden($variables) {
+ $node = $variables['node'];
global $user;
if (!$user->uid) {