hook_views_post_render

  1. drupal
    1. 6 docs.php function
    2. 7 views.api.php function
Drupal 7 hook_views_post_render(&$view, &$output, &$cache)

Post process any rendered data.

This can be valuable to be able to cache a view and still have some level of dynamic output. In an ideal world, the actual output will include HTML comment based tokens, and then the post process can replace those tokens.

Example usage. If it is known that the view is a node view and that the primary field will be a nid, you can do something like this:

<!--post-FIELD-NID-->

And then in the post render, create an array with the text that should go there:

strtr($output, array('<!--post-FIELD-1-->', 'output for FIELD of nid 1');

All of the cached result data will be available in $view->result, as well, so all ids used in the query should be discoverable.

This hook can be utilized by themes.

Related topics

1 invocation of hook_views_post_render()

File

sites/all/modules/views/docs/views.api.php, line 691
This file contains no working PHP code; it exists to provide additional documentation for doxygen as well as to document hooks in the standard Drupal manner.

Code

function hook_views_post_render(&$view, &$output, &$cache) {

}