You are here

function hook_views_preview_info_alter in Views (for Drupal 7) 7.3

Same name and namespace in other branches
  1. 8.3 views.api.php \hook_views_preview_info_alter()
  2. 6.3 docs/docs.php \hook_views_preview_info_alter()
  3. 6.2 docs/docs.php \hook_views_preview_info_alter()

Alter the information box that (optionally) appears with a view preview.

Includes 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

array $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.

object $view: The view object.

See also

theme_table()

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 1213
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)) . ')',
  );
}