Example: Render

  1. drupal
    1. 8
    2. 7

Demonstrate how render arrays are arranged and how they can be altered. This alters blocks and the page to show the actual render array that is being used to create each item.

See also

drupal_render()

Functions & methods

NameDescription
render_example_add_hrThis #post_render function gets to alter the rendered output after all theme functions have acted on it, and it receives the original data, so can make decisions based on that. In this example, no use is made of the passed-in $element.
render_example_add_prefixA '#post_render' function to add a little markup onto the end markup.
render_example_add_suffixA '#pre_render' function.
render_example_arraysProvides a number of render arrays and show what they do.
render_example_change_to_olAdds a #type to the element before it gets rendered. In this case, changes from the default 'ul' to 'ol'.
render_example_demo_formBuilds the form that offers options of what items to show.
render_example_embedded_formUtility function to build a named form given a set of form elements.
render_example_infoSimple basic information about the module; an entry point.
render_example_menuImplements hook_menu().
render_example_page_alterImplements hook_page_alter().
render_example_themeImplements hook_theme().
theme_render_arrayThemes the render array (from the demonstration page).
theme_render_example_add_divWraps a div around the already-rendered #children.
theme_render_example_add_notesWraps a div and add a little text after the rendered #children.
theme_render_example_aggregateA #theme function.

examples/render_example/render_example.module, line 8