You are here

function render_example_cache_pre_render in Examples for Developers 7

A '#pre_render' function.

Parameters

array $element: The element which will be rendered.

Return value

array The altered element. In this case we add the #markup.

Related topics

1 string reference to 'render_example_cache_pre_render'
render_example_arrays in render_example/render_example.module
Provides a number of render arrays and show what they do.

File

render_example/render_example.module, line 188
Demonstrates render arrays.

Code

function render_example_cache_pre_render($element) {
  $element['#markup'] = render_example_cache_expensive();

  // The following line is due to the bug described in
  // http://drupal.org/node/914792. A #markup element's #pre_render must set
  // #children because it replaces the default #markup pre_render, which is
  // drupal_pre_render_markup().
  $element['#children'] = $element['#markup'];
  return $element;
}