Output Alter

Component ID

1437250

Component name

Output Alter

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Component created

Component changed

Component body

Provides hook_alter_output()

Allows modification of page output, after the full page is rendered and before it's passed to the browser.

Usefull applications:

  • Add, remove elements from the DOM, allowing modifications to a page post theming.
  • Filter the output
    • Pass through HTML validation
    • Pass through HTML tidy
    • Anything else you can think of

Example

/**
 * Implements hook_output_alter().
 */
function my_module_output_alter(&$page) {

  $page = do_something_to_the_output($page);

}