function hook_views_preview_info_alter
3.x views.api.php | hook_views_preview_info_alter(&$rows, $view) |
2.x docs.php | hook_views_preview_info_alter(&$rows, $view) |
Alter the information box that (optionally) appears with a view preview, including query and performance statistics.
This hook should be placed in MODULENAME.views.inc and it will be auto-loaded. MODULENAME.views.inc must be in the directory specified by the 'path' key returned by MODULENAME_views_api(), or the same directory as the .module file, if 'path' is unspecified.
Warning: $view is not a reference in PHP4 and cannot be modified here. But it IS a reference in PHP5, and can be modified. Please be careful with it.
Parameters
$rows: An associative array with two keys:
- query: An array of rows suitable for theme('table'), containing information about the query and the display title and path.
- statistics: An array of rows suitable for theme('table'), containing performance statistics.
$view: The view object.
See also
Related topics
1 invocation of hook_views_preview_info_alter()
- views_ui_preview in includes/
admin.inc - Returns the results of the live preview.
File
- ./
views.api.php, line 1114 - Describe hooks provided by the Views module.
Code
function hook_views_preview_info_alter(&$rows, $view) {
// Adds information about the tables being queried by the view to the query
// part of the info box.
$rows['query'][] = array(
t('<strong>Table queue</strong>'),
count($view->query->table_queue) . ': (' . implode(', ', array_keys($view->query->table_queue)) . ')',
);
}