summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/common.inc20
-rw-r--r--modules/field/field.module2
-rw-r--r--modules/node/node.tpl.php6
-rw-r--r--modules/user/user-profile.tpl.php2
-rw-r--r--themes/garland/node.tpl.php8
5 files changed, 19 insertions, 19 deletions
diff --git a/includes/common.inc b/includes/common.inc
index bc211bfeb..5004f5e64 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -3838,7 +3838,7 @@ function drupal_render(&$elements) {
}
}
}
-
+
// Add additional CSS and JavaScript files associated with this element.
foreach (array('css', 'js') as $kind) {
if (!empty($elements['#attached_' . $kind]) && is_array($elements['#attached_' . $kind])) {
@@ -3894,13 +3894,11 @@ function drupal_render_children(&$element, $children_keys = NULL) {
/**
* Render and print an element.
*
- * This function renders an element using drupal_render() and then prints out
- * the rendered output. The top level element is always rendered and printed
- * even if hide() had been previously used on it.
+ * This function renders an element using drupal_render(). The top level
+ * element is always rendered even if hide() had been previously used on it.
*
- * Any nested elements are only printed if they haven't been printed before or
- * if they have been re-enabled with show(). If the element is a string instead
- * of a renderable array it is also printed.
+ * Any nested elements are only rendered if they haven't been rendered before
+ * or if they have been re-enabled with show().
*
* @see drupal_render()
* @see show()
@@ -3909,10 +3907,12 @@ function drupal_render_children(&$element, $children_keys = NULL) {
function render(&$element) {
if (is_array($element)) {
show($element);
- print drupal_render($element);
+ return drupal_render($element);
}
else {
- print $element;
+ // Safe-guard for inappropriate use of render() on flat variables: return
+ // the variable as-is.
+ return $element;
}
}
@@ -3931,7 +3931,7 @@ function hide(&$element) {
* Show a hidden or already printed element from later rendering.
*
* Alternatively, render($element) could be used which automatically shows the
- * element while rendering and printing it.
+ * element while rendering it.
*
* @see render()
* @see hide()
diff --git a/modules/field/field.module b/modules/field/field.module
index 0bfd91553..9b8ddbead 100644
--- a/modules/field/field.module
+++ b/modules/field/field.module
@@ -471,7 +471,7 @@ function field_format($obj_type, $object, $field, $item, $formatter_name = NULL,
* Return a single field, fully themed with label and multiple values.
*
* To be used by third-party code (Views, Panels...) that needs to output
- * an isolated field. Do *not* use inside node templates, use the
+ * an isolated field. Do *not* use inside node templates, use
* render($content[FIELD_NAME]) instead.
*
* The field will be displayed using the display options (label display,
diff --git a/modules/node/node.tpl.php b/modules/node/node.tpl.php
index 77c1f9642..362907f38 100644
--- a/modules/node/node.tpl.php
+++ b/modules/node/node.tpl.php
@@ -91,12 +91,12 @@
// We hide the comments and links now so that we can render them later.
hide($content['comments']);
hide($content['links']);
- render($content);
+ print render($content);
?>
</div>
- <?php render($content['links']); ?>
+ <?php print render($content['links']); ?>
- <?php render($content['comments']); ?>
+ <?php print render($content['comments']); ?>
</div>
diff --git a/modules/user/user-profile.tpl.php b/modules/user/user-profile.tpl.php
index a6d49b4a0..8b50f7026 100644
--- a/modules/user/user-profile.tpl.php
+++ b/modules/user/user-profile.tpl.php
@@ -28,5 +28,5 @@
*/
?>
<div class="profile">
- <?php render($user_profile); ?>
+ <?php print render($user_profile); ?>
</div>
diff --git a/themes/garland/node.tpl.php b/themes/garland/node.tpl.php
index 6af899bc1..d1fa348ec 100644
--- a/themes/garland/node.tpl.php
+++ b/themes/garland/node.tpl.php
@@ -13,21 +13,21 @@
<?php endif; ?>
<div class="content clearfix">
- <?php hide($content['links']); hide($content['comments']); render($content); ?>
+ <?php hide($content['links']); hide($content['comments']); print render($content); ?>
</div>
<div class="clearfix">
<div class="meta">
<?php if (!empty($content['links']['terms'])): ?>
- <div class="terms"><?php render($content['links']['terms']) ?></div>
+ <div class="terms"><?php print render($content['links']['terms']) ?></div>
<?php endif;?>
</div>
<?php if (!empty($content['links'])): ?>
- <div class="links"><?php render($content['links']) ?></div>
+ <div class="links"><?php print render($content['links']) ?></div>
<?php endif; ?>
- <?php render($content['comments']); ?>
+ <?php print render($content['comments']); ?>
</div>