summaryrefslogtreecommitdiff
path: root/modules/comment
diff options
context:
space:
mode:
Diffstat (limited to 'modules/comment')
-rw-r--r--modules/comment/comment.module27
-rw-r--r--modules/comment/comment.tpl.php25
2 files changed, 43 insertions, 9 deletions
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 8cf30b3dc..1357a3462 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -162,6 +162,7 @@ function comment_theme() {
),
'comment' => array(
'arguments' => array('comment' => NULL, 'links' => array()),
+ 'file' => 'comment.tpl.php',
),
'comment_folded' => array(
'arguments' => array('comment' => NULL),
@@ -1811,15 +1812,23 @@ function comment_controls_submit($form_id, $form_values) {
}
}
-function theme_comment($comment, $links = array()) {
- $output = '<div class="comment'. ($comment->status == COMMENT_NOT_PUBLISHED ? ' comment-unpublished' : '') .'">';
- $output .= '<div class="subject">'. l($comment->subject, $_GET['q'], array('fragment' => "comment-$comment->cid")) .' '. theme('mark', $comment->new) ."</div>\n";
- $output .= '<div class="credit">'. t('by %a on %b', array('%a' => theme('username', $comment), '%b' => format_date($comment->timestamp))) ."</div>\n";
- $output .= '<div class="body">'. $comment->comment .'</div>';
- $output .= theme('user_signature', $comment->signature);
- $output .= '<div class="links">'. theme('links', $links) .'</div>';
- $output .= '</div>';
- return $output;
+/**
+ * Prepare values for comment.tpl.php
+ */
+function template_preprocess_comment(&$variables) {
+ $comment = $variables['comment'];
+ $variables['author'] = theme('username', $comment);
+ $variables['comment'] = $comment;
+ $variables['content'] = $comment->comment;
+ $variables['date'] = format_date($comment->timestamp);
+ $variables['links'] = isset($variables['links']) ? theme('links', $variables['links']) : '';
+ $variables['new'] = $comment->new ? t('new') : '';
+ $variables['picture'] = theme_get_setting('toggle_comment_user_picture') ? theme('user_picture', $comment) : '';
+ $variables['signature'] = $comment->signature;
+ $variables['submitted'] = t('Submitted by !a on @b.',
+ array('!a' => theme('username', $comment),
+ '@b' => format_date($comment->timestamp)));
+ $variables['title'] = l($comment->subject, $_GET['q'], array('fragment' => "comment-$comment->cid"));
}
function theme_comment_folded($comment) {
diff --git a/modules/comment/comment.tpl.php b/modules/comment/comment.tpl.php
new file mode 100644
index 000000000..ac4eeb88a
--- /dev/null
+++ b/modules/comment/comment.tpl.php
@@ -0,0 +1,25 @@
+<div class="comment<?php print ($comment->new) ? ' comment-new' : ''; print ($comment->status == COMMENT_NOT_PUBLISHED) ? ' comment-unpublished' : ''; ?> clear-block">
+ <?php print $picture ?>
+
+<?php if ($comment->new) : ?>
+ <a id="new"></a>
+ <span class="new"><?php print $new ?></span>
+<?php endif; ?>
+
+ <h3><?php print $title ?></h3>
+
+ <div class="submitted">
+ <?php print $submitted ?>
+ </div>
+
+ <div class="content">
+ <?php print $content ?>
+ <?php if ($signature): ?>
+ <div class="user-signature clear-block">
+ <?php print $signature ?>
+ </div>
+ <?php endif; ?>
+ </div>
+
+ <?php print $links ?>
+</div>