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) {
}
}
}
// 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()
......
......@@ -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,
......
......@@ -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>
......@@ -28,5 +28,5 @@
*/
?>
<div class="profile">
<?php render($user_profile); ?>
<?php print render($user_profile); ?>
</div>
......@@ -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>
......
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