Heine

  • home
  • drupal
  • drupal core commits
  • about
Home › Drupal Core Commits

Commit 257282 by webchick

#364470 by stBorchert and JohnAlbin: Made theming of 'Submitted by author, on date' easier.

--- includes/theme.inc  2009/08/26 10:53:45     1.516
+++ includes/theme.inc  2009/08/29 04:16:14     1.517
@@ -610,7 +610,7 @@
  * - MODULE_preprocess_HOOK(&$variables)
  *   This is for modules that want to alter or provide extra variables for
  *   theming hooks not registered to itself. For example, if a module named
- *   "foo" wanted to alter the $submitted variable for the hook "node" a
+ *   "foo" wanted to alter the $classes_array variable for the hook "node" a
  *   preprocess function of foo_preprocess_node() can be created to intercept
  *   and alter the variable.
  *
@@ -624,8 +624,8 @@
  *
  * - THEME_preprocess(&$variables)
  *   This is for themes that want to alter or provide extra variables. For
- *   example, if a theme named "foo" wanted to alter the $submitted variable for
- *   the hook "node" a preprocess function of foo_preprocess_node() can be
+ *   example, if a theme named "foo" wanted to alter the $classes_array variable
+ *   for the hook "node" a preprocess function of foo_preprocess_node() can be
  *   created to intercept and alter the variable.
  *
  * - THEME_preprocess_HOOK(&$variables)
@@ -646,7 +646,7 @@
  * - MODULE_process_HOOK(&$variables)
  *   This is for modules that want to alter or provide extra variables for
  *   theming hooks not registered to itself. For example, if a module named
- *   "foo" wanted to alter the $submitted variable for the hook "node" a
+ *   "foo" wanted to alter the $classes_array variable for the hook "node" a
  *   process function of foo_process_node() can be created to intercept
  *   and alter the variable.
  *

--- modules/comment/comment.module      2009/08/26 10:28:45     1.762
+++ modules/comment/comment.module      2009/08/29 04:16:14     1.763
@@ -148,9 +148,6 @@
       'template' => 'comment-wrapper',
       'arguments' => array('content' => NULL),
     ),
-    'comment_submitted' => array(
-      'arguments' => array('comment' => NULL),
-    ),
   );
 }
 
@@ -2088,7 +2085,6 @@
   $variables['new']       = !empty($comment->new) ? t('new') : '';
   $variables['picture']   = theme_get_setting('toggle_comment_user_picture') ? theme('user_picture', $comment) : '';
   $variables['signature'] = $comment->signature;
-  $variables['submitted'] = theme('comment_submitted', $comment);
   $variables['title']     = l($comment->subject, 'comment/' . $comment->cid, array('fragment' => "comment-$comment->cid"));
   $variables['template_files'][] = 'comment-' . $variables['node']->type;
   // Set status to a string representation of comment->status.
@@ -2170,21 +2166,6 @@
 }
 
 /**
- * Theme a "Submitted by ..." notice.
- *
- * @param $comment
- *   The comment.
- * @ingroup themeable
- */
-function theme_comment_submitted($comment) {
-  return t('Submitted by !username on @datetime.',
-    array(
-      '!username' => theme('username', $comment),
-      '@datetime' => format_date($comment->timestamp)
-    ));
-}
-
-/**
  * Return an array of viewing modes for comment listings.
  *
  * We can't use a global variable array because the locale system

--- modules/comment/comment.tpl.php     2009/07/28 10:09:25     1.10
+++ modules/comment/comment.tpl.php     2009/08/29 04:16:14     1.11
@@ -17,7 +17,6 @@
  * - $signature: Authors signature.
  * - $status: Comment status. Possible values are:
  *   comment-unpublished, comment-published or comment-preview.
- * - $submitted: By line with date and time.
  * - $title: Linked title.
  * - $classes: String of classes that can be used to style contextually through
  *   CSS. It can be manipulated through the variable $classes_array from
@@ -55,7 +54,10 @@
   <h3><?php print $title ?></h3>
 
   <div class="submitted">
-    <?php print $submitted ?>
+    <?php
+      print t('Submitted by !username on @datetime.',
+        array('!username' => $author, '@datetime' => $date));
+    ?>
   </div>
 
   <div class="content">

--- modules/node/node.module    2009/08/25 21:53:47     1.1112
+++ modules/node/node.module    2009/08/29 04:16:14     1.1113
@@ -128,9 +128,6 @@
     'node_log_message' => array(
       'arguments' => array('log' => NULL),
     ),
-    'node_submitted' => array(
-      'arguments' => array('node' => NULL),
-    ),
     'node_admin_overview' => array(
       'arguments' => array('name' => NULL, 'type' => NULL),
     ),
@@ -1142,11 +1139,11 @@
 
   // Display post information only on certain node types.
   if (variable_get('node_submitted_' . $node->type, TRUE)) {
-    $variables['submitted'] = theme('node_submitted', $node);
+    $variables['display_submitted'] = TRUE;
     $variables['user_picture'] = theme_get_setting('toggle_node_user_picture') ? theme('user_picture', $node) : '';
   }
   else {
-    $variables['submitted'] = '';
+    $variables['display_submitted'] = FALSE;
     $variables['user_picture'] = '';
   }
 
@@ -2808,19 +2805,6 @@
 }
 
 /**
- * Format the "Submitted by username on date/time" for each node
- *
- * @ingroup themeable
- */
-function theme_node_submitted($node) {
-  return t('Submitted by !username on @datetime',
-    array(
-      '!username' => theme('username', $node),
-      '@datetime' => format_date($node->created),
-    ));
-}
-
-/**
  * Implement hook_hook_info().
  */
 function node_hook_info() {

--- modules/node/node.test      2009/08/25 02:48:16     1.42
+++ modules/node/node.test      2009/08/29 04:16:15     1.43
@@ -533,7 +533,7 @@
 
     // Check that the post information is displayed.
     $node = $this->drupalGetNodeByTitle($edit['title']);
-    $this->assertRaw(theme('node_submitted', $node), t('Post information is displayed.'));
+    $this->assertRaw('<span class="submitted">', t('Post information is displayed.'));
   }
 
   /**
@@ -555,7 +555,7 @@
 
     // Check that the post information is displayed.
     $node = $this->drupalGetNodeByTitle($edit['title']);
-    $this->assertNoRaw(theme('node_submitted', $node), t('Post information is not displayed.'));
+    $this->assertNoRaw('<span class="submitted">', t('Post information is not displayed.'));
   }
 }
 

--- modules/node/node.tpl.php   2009/08/22 00:58:54     1.20
+++ modules/node/node.tpl.php   2009/08/29 04:16:15     1.21
@@ -17,8 +17,7 @@
  * - $name: Themed username of node author output from theme_username().
  * - $node_url: Direct url of the current node.
  * - $terms: the themed list of taxonomy term links output from theme_links().
- * - $submitted: themed submission information output from
- *   theme_node_submitted().
+ * - $display_submitted: whether submission information should be displayed.
  * - $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 following:
@@ -79,10 +78,15 @@
     <h2><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2>
   <?php endif; ?>
 
-  <?php if ($submitted || !empty($content['links']['terms'])): ?>
+  <?php if ($display_submitted || !empty($content['links']['terms'])): ?>
     <div class="meta">
-      <?php if ($submitted): ?>
-        <span class="submitted"><?php print $submitted; ?></span>
+      <?php if ($display_submitted): ?>
+        <span class="submitted">
+          <?php
+            print t('Submitted by !username on @datetime',
+              array('!username' => $name, '@datetime' => $date));
+          ?>
+        </span>
       <?php endif; ?>
 
       <?php if (!empty($content['links']['terms'])): ?>

--- themes/garland/comment.tpl.php      2009/07/28 10:09:25     1.14
+++ themes/garland/comment.tpl.php      2009/08/29 04:16:15     1.15
@@ -1,12 +1,11 @@
 <?php
-// $Id: comment.tpl.php,v 1.13 2009/05/28 16:44:07 webchick Exp $
+// $Id: comment.tpl.php,v 1.14 2009/07/28 10:09:25 dries Exp $
 ?>
 <div class="<?php print $classes . ' ' . $zebra; ?>">
 
   <div class="clearfix">
-  <?php if ($submitted): ?>
-    <span class="submitted"><?php print $submitted; ?></span>
-  <?php endif; ?>
+
+    <span class="submitted"><?php print $date; ?> — <?php print $author; ?></span>
 
   <?php if ($new) : ?>
     <span class="new"><?php print drupal_ucfirst($new) ?></span>

--- themes/garland/node.tpl.php 2009/08/06 05:06:00     1.14
+++ themes/garland/node.tpl.php 2009/08/29 04:16:15     1.15
@@ -9,8 +9,8 @@
     <h2><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2>
   <?php endif; ?>
 
-  <?php if ($submitted): ?>
-    <span class="submitted"><?php print $submitted; ?></span>
+  <?php if ($display_submitted): ?>
+    <span class="submitted"><?php print $date; ?> — <?php print $name; ?></span>
   <?php endif; ?>
 
   <div class="content clearfix">

--- themes/garland/template.php 2009/08/25 15:39:13     1.27
+++ themes/garland/template.php 2009/08/29 04:16:15     1.28
@@ -80,28 +80,6 @@
 }
 
 /**
- * Format the "Submitted by username on date/time" for each comment.
- */
-function garland_comment_submitted($comment) {
-  return t('!datetime — !username',
-    array(
-      '!username' => theme('username', $comment),
-      '!datetime' => format_date($comment->timestamp)
-    ));
-}
-
-/**
- * Format the "Submitted by username on date/time" for each node.
- */
-function garland_node_submitted($node) {
-  return t('!datetime — !username',
-    array(
-      '!username' => theme('username', $node),
-      '!datetime' => format_date($node->created),
-    ));
-}
-
-/**
  * Generates IE CSS links for LTR and RTL languages.
  */
 function garland_get_ie_styles() {

No votes yet
  • Drupal Core
  • Download patch

Recent posts

  • Bugfix woes for Drupal 6
  • Arbitrary PHP code execution in modx 1.0.0 via CSRF
  • The #drupal consultant
  • Varnish vs. page cache graph
  • FAPI - How to decrease/increase the text limit of textfields?
more

Tags

Captcha CSRF Drupal Let's hope it doesn't become popular modx Performance PHP Pitfalls Planet Drupal Security V-PowerServer Varnish
more tags
  • home
  • drupal
  • drupal core commits
  • about

Copyright © 2009 by Heine Deelstra. All rights reserved.