Other hooks
In addition to the hooks that feed information to Views, covered in the previous sections, Views also provides hooks that allow your module to modify the view in some fashion.
hook_views_query_alter(&$query, &$view, $summary, $level)- Allows a module to alter a query just before it is created. Note that this is only called when the query is actually generated, not necessarily every time the view is run -- this is because some queries may be cached.
Parameters
&$query The fully populated $query object.
&$view The view the query is being built for.
$summary If true, $view is in summary mode.
$level If in summary mode, $level is the index of the argument that is powering the summary. See the arguments section for more information.
Return value
None.
hook_views_query_substitutions($view)Parameters
&$view The view the query is being run for.
Return value
An array of key-value substitutions. The key is the text to replace, and the value is the text to insert.
hook_views_pre_query(&$view)Parameters
&$view The view the query is being run for.
Return value
A string that will be prepended to the view.
hook_views_pre_view(&$view, &$items)Parameters
&$view The view being themed.
&$items The items returned by the view.
Return value
A string that will be prepended to the view.
hook_views_post_view(&$view, &$items)Parameters
&$view The view being themed.
&$items The items returned by the view.
Return value
A string that will be appended to the view.
