diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-12-01 00:18:15 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-12-01 00:18:15 +0000 |
commit | 9ada5dec79b8f42e47a7245a91b669e240c6f6c9 (patch) | |
tree | 4c442b288dcedfef32ee31e6e85004db5d37c19c /modules | |
parent | 66ffb5f7e8562a2f880be3b58dcf1e602cd95d4f (diff) | |
download | brdo-9ada5dec79b8f42e47a7245a91b669e240c6f6c9.tar.gz brdo-9ada5dec79b8f42e47a7245a91b669e240c6f6c9.tar.bz2 |
#364470 follow-up by Dave Reid, JohnAlbin, et al: Move submitted by back into a variable. The string approach was too limited.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/comment/comment.module | 1 | ||||
-rw-r--r-- | modules/comment/comment.tpl.php | 7 | ||||
-rw-r--r-- | modules/node/node.module | 2 | ||||
-rw-r--r-- | modules/node/node.tpl.php | 9 | ||||
-rw-r--r-- | modules/rdf/rdf.module | 8 |
5 files changed, 18 insertions, 9 deletions
diff --git a/modules/comment/comment.module b/modules/comment/comment.module index b279ef324..2a83aced0 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -2258,6 +2258,7 @@ function template_preprocess_comment(&$variables) { $variables['title'] = l($comment->subject, $uri['path'], $uri['options']); $variables['permalink'] = l(t('Permalink'), $uri['path'], $uri['options']); + $variables['submitted'] = t('Submitted by !username on !datetime', array('!username' => $variables['author'], '!datetime' => $variables['created'])); // Preprocess fields. field_attach_preprocess('comment', $comment, $variables['elements'], $variables); diff --git a/modules/comment/comment.tpl.php b/modules/comment/comment.tpl.php index 314da57ca..adf93b31c 100644 --- a/modules/comment/comment.tpl.php +++ b/modules/comment/comment.tpl.php @@ -19,6 +19,8 @@ * desired parameters on the $comment->changed variable. * - $new: New comment marker. * - $permalink: Comment permalink. + * - $submitted: Submission information created from $author and $created during + * template_preprocess_comment(). * - $picture: Authors picture. * - $signature: Authors signature. * - $status: Comment status. Possible values are: @@ -69,10 +71,7 @@ <div class="submitted"> <?php print $permalink; ?> - <?php - print t('Submitted by !username on !datetime.', - array('!username' => $author, '!datetime' => $created)); - ?> + <?php print $submitted; ?> </div> <div class="content"<?php print $content_attributes; ?>> diff --git a/modules/node/node.module b/modules/node/node.module index d7cc85d83..47173cc04 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -1467,10 +1467,12 @@ function template_preprocess_node(&$variables) { // Display post information only on certain node types. if (variable_get('node_submitted_' . $node->type, TRUE)) { $variables['display_submitted'] = TRUE; + $variables['submitted'] = t('Submitted by !username on !datetime', array('!username' => $variables['name'], '!datetime' => $variables['date'])); $variables['user_picture'] = theme_get_setting('toggle_node_user_picture') ? theme('user_picture', array('account' => $node)) : ''; } else { $variables['display_submitted'] = FALSE; + $variables['submitted'] = ''; $variables['user_picture'] = ''; } diff --git a/modules/node/node.tpl.php b/modules/node/node.tpl.php index 952f20a9d..26128960d 100644 --- a/modules/node/node.tpl.php +++ b/modules/node/node.tpl.php @@ -16,7 +16,9 @@ * calling format_date() with the desired parameters on the $created variable. * - $name: Themed username of node author output from theme_username(). * - $node_url: Direct url of the current node. - * - $display_submitted: whether submission information should be displayed. + * - $display_submitted: Whether submission information should be displayed. + * - $submitted: Submission information created from $name and $date during + * template_preprocess_node(). * - $classes: String of classes that can be used to style contextually through * CSS. It can be manipulated through the variable $classes_array from * preprocess functions. The default values can be one or more of the @@ -89,10 +91,7 @@ <?php if ($display_submitted): ?> <div class="submitted"> - <?php - print t('Submitted by !username on !datetime', - array('!username' => $name, '!datetime' => $date)); - ?> + <?php print $submitted; ?> </div> <?php endif; ?> diff --git a/modules/rdf/rdf.module b/modules/rdf/rdf.module index a8d62fe22..07c03b37b 100644 --- a/modules/rdf/rdf.module +++ b/modules/rdf/rdf.module @@ -499,10 +499,16 @@ function rdf_preprocess_node(&$variables) { if (!empty($variables['rdf_mapping']['created'])) { $date_attributes_array = rdf_rdfa_attributes($variables['rdf_mapping']['created'], $variables['created']); $variables['rdf_template_variable_attributes_array']['date'] = $date_attributes_array; + if ($variables['submitted']) { + $variables['rdf_template_variable_attributes_array']['submitted'] = $date_attributes_array; + } } // Adds RDFa markup for the relation between the node and its author. if (!empty($variables['rdf_mapping']['uid'])) { $variables['rdf_template_variable_attributes_array']['name']['rel'] = $variables['rdf_mapping']['uid']['predicates']; + if ($variables['submitted']) { + $variables['rdf_template_variable_attributes_array']['submitted']['rel'] = $variables['rdf_mapping']['uid']['predicates']; + } } // Adds RDFa markup annotating the number of comments a node has. @@ -679,10 +685,12 @@ function rdf_preprocess_comment(&$variables) { // cached as part of the entity. $date_attributes_array = $comment->rdf_data['date']; $variables['rdf_template_variable_attributes_array']['created'] = $date_attributes_array; + $variables['rdf_template_variable_attributes_array']['submitted'] = $date_attributes_array; } // Adds RDFa markup for the relation between the comment and its author. if (!empty($comment->rdf_mapping['uid'])) { $variables['rdf_template_variable_attributes_array']['author']['rel'] = $comment->rdf_mapping['uid']['predicates']; + $variables['rdf_template_variable_attributes_array']['submitted']['rel'] = $comment->rdf_mapping['uid']['predicates']; } if (!empty($comment->rdf_mapping['title'])) { // Adds RDFa markup to the subject of the comment. Because the RDFa markup |