Commit beadf384 authored by webchick's avatar webchick

#455844 follow-up by yched: Change render() to print render() for consistency...

#455844 follow-up by yched: Change render() to print render() for consistency with other template variables.
parent 6682ab93
...@@ -3838,7 +3838,7 @@ function drupal_render(&$elements) { ...@@ -3838,7 +3838,7 @@ function drupal_render(&$elements) {
} }
} }
} }
// Add additional CSS and JavaScript files associated with this element. // Add additional CSS and JavaScript files associated with this element.
foreach (array('css', 'js') as $kind) { foreach (array('css', 'js') as $kind) {
if (!empty($elements['#attached_' . $kind]) && is_array($elements['#attached_' . $kind])) { if (!empty($elements['#attached_' . $kind]) && is_array($elements['#attached_' . $kind])) {
...@@ -3894,13 +3894,11 @@ function drupal_render_children(&$element, $children_keys = NULL) { ...@@ -3894,13 +3894,11 @@ function drupal_render_children(&$element, $children_keys = NULL) {
/** /**
* Render and print an element. * Render and print an element.
* *
* This function renders an element using drupal_render() and then prints out * This function renders an element using drupal_render(). The top level
* the rendered output. The top level element is always rendered and printed * element is always rendered even if hide() had been previously used on it.
* even if hide() had been previously used on it.
* *
* Any nested elements are only printed if they haven't been printed before or * Any nested elements are only rendered if they haven't been rendered before
* if they have been re-enabled with show(). If the element is a string instead * or if they have been re-enabled with show().
* of a renderable array it is also printed.
* *
* @see drupal_render() * @see drupal_render()
* @see show() * @see show()
...@@ -3909,10 +3907,12 @@ function drupal_render_children(&$element, $children_keys = NULL) { ...@@ -3909,10 +3907,12 @@ function drupal_render_children(&$element, $children_keys = NULL) {
function render(&$element) { function render(&$element) {
if (is_array($element)) { if (is_array($element)) {
show($element); show($element);
print drupal_render($element); return drupal_render($element);
} }
else { 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) { ...@@ -3931,7 +3931,7 @@ function hide(&$element) {
* Show a hidden or already printed element from later rendering. * Show a hidden or already printed element from later rendering.
* *
* Alternatively, render($element) could be used which automatically shows the * Alternatively, render($element) could be used which automatically shows the
* element while rendering and printing it. * element while rendering it.
* *
* @see render() * @see render()
* @see hide() * @see hide()
......
...@@ -471,7 +471,7 @@ function field_format($obj_type, $object, $field, $item, $formatter_name = NULL, ...@@ -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. * Return a single field, fully themed with label and multiple values.
* *
* To be used by third-party code (Views, Panels...) that needs to output * 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. * render($content[FIELD_NAME]) instead.
* *
* The field will be displayed using the display options (label display, * The field will be displayed using the display options (label display,
......
...@@ -91,12 +91,12 @@ ...@@ -91,12 +91,12 @@
// We hide the comments and links now so that we can render them later. // We hide the comments and links now so that we can render them later.
hide($content['comments']); hide($content['comments']);
hide($content['links']); hide($content['links']);
render($content); print render($content);
?> ?>
</div> </div>
<?php render($content['links']); ?> <?php print render($content['links']); ?>
<?php render($content['comments']); ?> <?php print render($content['comments']); ?>
</div> </div>
...@@ -28,5 +28,5 @@ ...@@ -28,5 +28,5 @@
*/ */
?> ?>
<div class="profile"> <div class="profile">
<?php render($user_profile); ?> <?php print render($user_profile); ?>
</div> </div>
...@@ -13,21 +13,21 @@ ...@@ -13,21 +13,21 @@
<?php endif; ?> <?php endif; ?>
<div class="content clearfix"> <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>
<div class="clearfix"> <div class="clearfix">
<div class="meta"> <div class="meta">
<?php if (!empty($content['links']['terms'])): ?> <?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;?> <?php endif;?>
</div> </div>
<?php if (!empty($content['links'])): ?> <?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 endif; ?>
<?php render($content['comments']); ?> <?php print render($content['comments']); ?>
</div> </div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment