summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/node/node.module12
-rw-r--r--modules/node/node.tpl.php22
-rw-r--r--modules/system/page.tpl.php8
-rw-r--r--modules/user/user-profile.tpl.php34
-rw-r--r--modules/user/user.pages.inc13
5 files changed, 30 insertions, 59 deletions
diff --git a/modules/node/node.module b/modules/node/node.module
index 85bcceb36..ad7bedbe5 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -1247,18 +1247,6 @@ function template_preprocess_node(&$variables) {
unset($node->content['links']);
}
- // Render taxonomy links separately.
- $variables['terms'] = !empty($node->content['links']['terms']) ? drupal_render($node->content['links']['terms']) : '';
-
- // Render all remaining node links.
- $variables['links'] = !empty($node->content['links']) ? drupal_render($node->content['links']) : '';
-
- // Render any comments.
- $variables['comments'] = !empty($node->content['comments']) ? drupal_render($node->content['comments']) : '';
-
- // Render the rest of the node into $content.
- $variables['content'] = drupal_render($node->content);
-
// Flatten the node object's member fields.
$variables = array_merge((array)$node, $variables);
diff --git a/modules/node/node.tpl.php b/modules/node/node.tpl.php
index 92e6c128e..49979a22d 100644
--- a/modules/node/node.tpl.php
+++ b/modules/node/node.tpl.php
@@ -7,7 +7,10 @@
*
* Available variables:
* - $title: the (sanitized) title of the node.
- * - $content: Node body or teaser depending on $teaser flag.
+ * - $content: An array of node items. Use render($content) to print them all, or
+ * print a subset such as render($content['field_example']). Use
+ * hide($content['field_example]) to temporarily suppress the printing of a
+ * given element.
* - $comments: the themed list of comments (if any).
* - $picture: The authors picture of the node output from
* theme_user_picture().
@@ -78,17 +81,22 @@
<span class="submitted"><?php print $submitted ?></span>
<?php endif; ?>
- <?php if ($terms): ?>
- <div class="terms terms-inline"><?php print $terms ?></div>
+ <?php if (!empty($content['links']['terms'])): ?>
+ <div class="terms terms-inline"><?php render($content['links']['terms']) ?></div>
<?php endif;?>
</div>
<div class="content">
- <?php print $content ?>
+ <?php
+ // We hide the comments and links now so that we can render them later.
+ hide($content['comments']);
+ hide($content['links']);
+ render($content);
+ ?>
</div>
- <?php print $links; ?>
+ <?php render($content['links']); ?>
- <?php print $comments; ?>
+ <?php render($content['comments']); ?>
-</div> \ No newline at end of file
+</div>
diff --git a/modules/system/page.tpl.php b/modules/system/page.tpl.php
index e55789a9a..18b15ee73 100644
--- a/modules/system/page.tpl.php
+++ b/modules/system/page.tpl.php
@@ -75,11 +75,11 @@
* - $tabs: Tabs linking to any sub-pages beneath the current page (e.g., the view
* and edit tabs when displaying a node).
* - $help: Dynamic help text, mostly for admin pages.
- * - $content: The main content of the current Drupal page.
+ * - $content: The main content of the current page.
* - $feed_icons: A string of all feed icons for the current page.
- * - $left: The HTML for the left sidebar.
- * - $right: The HTML for the right sidebar.
- * - $highlight: The HTML for the highlighted content region.
+ * - $left: Items for the left sidebar.
+ * - $right: Items for the right sidebar.
+ * - $highlight: Items for the highlighted content region.
*
* Footer/closing data:
* - $footer : The footer region.
diff --git a/modules/user/user-profile.tpl.php b/modules/user/user-profile.tpl.php
index 809b4c0f7..56cc72996 100644
--- a/modules/user/user-profile.tpl.php
+++ b/modules/user/user-profile.tpl.php
@@ -8,27 +8,13 @@
* This template is used when viewing a registered member's profile page,
* e.g., example.com/user/123. 123 being the users ID.
*
- * By default, all user profile data is printed out with the $user_profile
- * variable. If there is a need to break it up you can use $profile instead.
- * It is keyed to the name of each category or other data attached to the
- * account. If it is a category it will contain all the profile items. By
- * default $profile['summary'] is provided which contains data on the user's
- * history. Other data can be included by modules. $profile['user_picture'] is
- * available by default showing the account picture.
- *
- * Also keep in mind that profile items and their categories can be defined by
- * site administrators. They are also available within $profile. For example,
- * if a site is configured with a category of "contact" with
- * fields for of addresses, phone numbers and other related info, then doing a
- * straight print of $profile['contact'] will output everything in the
- * category. This is useful for altering source order and adding custom
- * markup for the group.
- *
- * To check for all available data within $profile, use the code below.
- *
- * @code
- * print '<pre>'. check_plain(print_r($profile, 1)) .'</pre>';
- * @endcode
+ * Use render($user_profile) to print all profile items, or print a subset
+ * such as render($content['field_example']). Always call render($user_profile)
+ * at the end in order to print all remaining items. If the item is a category,
+ * it will contain all its profile items. By default, $user_profile['summary']
+ * is provided which contains data on the user's history. Other data can be
+ * included by modules. $user_profile['user_picture'] is available
+ * for showing the account picture.
*
* @see user-profile-category.tpl.php
* Where the html is handled for the group.
@@ -36,14 +22,12 @@
* Where the html is handled for each item in the group.
*
* Available variables:
- * - $user_profile: All user profile data. Ready for print.
- * - $profile: Keyed array of profile categories and their items or other data
- * provided by modules.
+ * - $user_profile: An array of profile items. Use render() to print them.
* - TODO D7 : document $FIELD_NAME_rendered variables.
*
* @see template_preprocess_user_profile()
*/
?>
<div class="profile">
- <?php print $user_profile; ?>
+ <?php print render($user_profile); ?>
</div>
diff --git a/modules/user/user.pages.inc b/modules/user/user.pages.inc
index 2547b7bc8..07ad31dce 100644
--- a/modules/user/user.pages.inc
+++ b/modules/user/user.pages.inc
@@ -185,20 +185,11 @@ function user_view($account) {
* The $variables array contains the following arguments:
* - $account
*
- * @see user-picture.tpl.php
+ * @see user-profile.tpl.php
*/
function template_preprocess_user_profile(&$variables) {
$account = $variables['elements']['#account'];
-
- $variables['profile'] = array();
- // Sort sections by weight
- uasort($account->content, 'element_sort');
- // Provide keyed variables so themers can print each section independently.
- foreach (element_children($account->content) as $key) {
- $variables['profile'][$key] = drupal_render($account->content[$key]);
- }
- // Collect all profiles to make it easier to print all items at once.
- $variables['user_profile'] = implode($variables['profile']);
+ $variables['user_profile'] = $account->content;
// Add $FIELD_NAME_rendered variables for fields.
$variables += field_attach_preprocess('user', $account);