function hook_views_post_build

Same name in other branches
  1. 6.x-3.x docs/docs.php \hook_views_post_build()

This hook is called right after the build process.

The query is now fully built, but it has not yet been run through db_rewrite_sql.

Adding output to the view can be accomplished by placing text on $view->attachment_before and $view->attachment_after.

Parameters

object $view: The view object about to be processed.

Related topics

1 invocation of hook_views_post_build()
view::build in includes/view.inc
Build the query for the view.

File

./views.api.php, line 1033

Code

function hook_views_post_build(&$view) {
    // If the exposed field 'type' is set, hide the column containing the content
    // type. (Note that this is a solution for a particular view, and makes
    // assumptions about both exposed filter settings and the fields in the view.
    // Also note that this alter could be done at any point before the view being
    // rendered.)
    if ($view->name == 'my_view' && isset($view->exposed_raw_input['type']) && $view->exposed_raw_input['type'] != 'All') {
        // 'Type' should be interpreted as content type.
        if (isset($view->field['type'])) {
            $view->field['type']->options['exclude'] = TRUE;
        }
    }
}