1 render_example.module render_example_add_suffix($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 a #prefix to it.

Related topics

File

modules/examples/render_example/render_example.module, line 217
Demonstrates render arrays.

Code

function render_example_add_suffix($element) {
  $element['#suffix'] = '<div style="color:red">' . t('This #suffix was added by a #pre_render') . '</div>';

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