#146386 by kbahey: refactor 'submitted by user - date' themeing and make it more verbose to translate
parent
9e1c8ededc
commit
3409019929
|
@ -1609,7 +1609,7 @@ function template_preprocess_node(&$variables) {
|
||||||
|
|
||||||
// Display info only on certain node types.
|
// Display info only on certain node types.
|
||||||
if (theme_get_setting('toggle_node_info_' . $node->type)) {
|
if (theme_get_setting('toggle_node_info_' . $node->type)) {
|
||||||
$variables['submitted'] = t('Submitted by !a on @b.', array('!a' => theme('username', $node), '@b' => format_date($node->created)));
|
$variables['submitted'] = theme('node_submitted', $node);
|
||||||
$variables['picture'] = theme_get_setting('toggle_node_user_picture') ? theme('user_picture', $node) : '';
|
$variables['picture'] = theme_get_setting('toggle_node_user_picture') ? theme('user_picture', $node) : '';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1637,3 +1637,4 @@ function template_preprocess_block(&$variables) {
|
||||||
$variables['template_files'][] = 'block-' . $variables['block']->module;
|
$variables['template_files'][] = 'block-' . $variables['block']->module;
|
||||||
$variables['template_files'][] = 'block-' . $variables['block']->module .'-'. $variables['block']->delta;
|
$variables['template_files'][] = 'block-' . $variables['block']->module .'-'. $variables['block']->delta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -184,6 +184,9 @@ function comment_theme() {
|
||||||
'comment_wrapper' => array(
|
'comment_wrapper' => array(
|
||||||
'arguments' => array('content' => NULL),
|
'arguments' => array('content' => NULL),
|
||||||
),
|
),
|
||||||
|
'comment_submitted' => array(
|
||||||
|
'arguments' => array('comment' => NULL),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1853,9 +1856,7 @@ function template_preprocess_comment(&$variables) {
|
||||||
$variables['new'] = $comment->new ? t('new') : '';
|
$variables['new'] = $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', $comment) : '';
|
||||||
$variables['signature'] = $comment->signature;
|
$variables['signature'] = $comment->signature;
|
||||||
$variables['submitted'] = t('Submitted by !a on @b.',
|
$variables['submitted'] = theme('comment_submitted', $comment);
|
||||||
array('!a' => theme('username', $comment),
|
|
||||||
'@b' => format_date($comment->timestamp)));
|
|
||||||
$variables['title'] = l($comment->subject, $_GET['q'], array('fragment' => "comment-$comment->cid"));
|
$variables['title'] = l($comment->subject, $_GET['q'], array('fragment' => "comment-$comment->cid"));
|
||||||
$variables['template_files'][] = 'comment-'. $node->type;
|
$variables['template_files'][] = 'comment-'. $node->type;
|
||||||
}
|
}
|
||||||
|
@ -1917,6 +1918,17 @@ function theme_comment_wrapper($content) {
|
||||||
return '<div id="comments">'. $content .'</div>';
|
return '<div id="comments">'. $content .'</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make the submitted variable themable
|
||||||
|
*/
|
||||||
|
function theme_comment_submitted($comment) {
|
||||||
|
return t('Submitted by !username on @datetime.',
|
||||||
|
array(
|
||||||
|
'!username' => theme('username', $comment),
|
||||||
|
'@datetime' => format_date($comment->timestamp)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
function _comment_delete_thread($comment) {
|
function _comment_delete_thread($comment) {
|
||||||
if (!is_object($comment) || !is_numeric($comment->cid)) {
|
if (!is_object($comment) || !is_numeric($comment->cid)) {
|
||||||
watchdog('content', 'Can not delete non-existent comment.', WATCHDOG_WARNING);
|
watchdog('content', 'Can not delete non-existent comment.', WATCHDOG_WARNING);
|
||||||
|
|
|
@ -84,6 +84,9 @@ function node_theme() {
|
||||||
'node_log_message' => array(
|
'node_log_message' => array(
|
||||||
'arguments' => array('log' => NULL),
|
'arguments' => array('log' => NULL),
|
||||||
),
|
),
|
||||||
|
'node_submitted' => array(
|
||||||
|
'arguments' => array('node' => NULL),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3204,6 +3207,17 @@ function node_forms() {
|
||||||
return $forms;
|
return $forms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format the "Submitted by username on date/time" for each node
|
||||||
|
*/
|
||||||
|
function theme_node_submitted($node) {
|
||||||
|
return t('Submitted by !username on @datetime',
|
||||||
|
array(
|
||||||
|
'!username' => theme('username', $node),
|
||||||
|
'@datetime' => format_date($node->created),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of hook_hook_info().
|
* Implementation of hook_hook_info().
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<div class="clear-block">
|
<div class="clear-block">
|
||||||
<?php if ($submitted): ?>
|
<?php if ($submitted): ?>
|
||||||
<span class="submitted"><?php print t('!date — !username', array('!username' => theme('username', $comment), '!date' => format_date($comment->timestamp))); ?></span>
|
<span class="submitted"><?php print $submitted; ?></span>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if ($comment->new) : ?>
|
<?php if ($comment->new) : ?>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if ($submitted): ?>
|
<?php if ($submitted): ?>
|
||||||
<span class="submitted"><?php print t('!date — !username', array('!username' => theme('username', $node), '!date' => format_date($node->created))); ?></span>
|
<span class="submitted"><?php print $submitted; ?></span>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
|
|
@ -83,3 +83,19 @@ function phptemplate_menu_local_tasks() {
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function phptemplate_comment_submitted($comment) {
|
||||||
|
return t('!datetime — !username',
|
||||||
|
array(
|
||||||
|
'!username' => theme('username', $comment),
|
||||||
|
'!datetime' => format_date($comment->timestamp)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
function phptemplate_node_submitted($node) {
|
||||||
|
return t('!datetime — !username',
|
||||||
|
array(
|
||||||
|
'!username' => theme('username', $node),
|
||||||
|
'!datetime' => format_date($node->created),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue