1 render_example.module render_example_cache_pre_render($element)

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

File

modules/examples/render_example/render_example.module, line 184
Hook implementations for the Render Example module.

Code

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

  // @todo Correct the following code, since the workaround is not necessary.
  // See https://www.drupal.org/node/914792
  $element['#children'] = $element['#markup'];
  return $element;
}