drupal_render_cache_get
- Versions
- 7
drupal_render_cache_get($elements)
Get the rendered output of a renderable element from cache.
See also
@see drupal_render_cache_set()
Parameters
$elements A renderable array.
Return value
A markup string containing the rendered content of the element, or FALSE if no cached copy of the element is available.
Code
includes/common.inc, line 5183
<?php
function drupal_render_cache_get($elements) {
if (!in_array($_SERVER['REQUEST_METHOD'], array('GET', 'HEAD')) || !$cid = drupal_render_cid_create($elements)) {
return FALSE;
}
$bin = isset($elements['#cache']['bin']) ? $elements['#cache']['bin'] : 'cache';
if (!empty($cid) && $cache = cache_get($cid, $bin)) {
// Add additional libraries, JavaScript, CSS and other data attached
// to this element.
if (isset($cache->data['#attached'])) {
drupal_process_attached($cache->data);
}
// Return the rendered output.
return $cache->data['#markup'];;
}
return FALSE;
}
?>Login or register to post comments 