You are here

function hook_views_preview_info_alter in Views (for Drupal 7) 8.3

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

Alter the view preview information.

The view preview information is optionally displayed when a view is previewed in the administrative UI. It includes query and performance statistics.

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.

\Drupal\views\ViewExecutable $view: The view object.

See also

\Drupal\views_ui\ViewUI

theme_table()

Related topics

1 invocation of hook_views_preview_info_alter()
ViewUI::renderPreview in views_ui/lib/Drupal/views_ui/ViewUI.php

File

./views.api.php, line 572
Describes hooks and plugins provided by the Views module.

Code

function hook_views_preview_info_alter(array &$rows, ViewExecutable $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)) . ')',
  );
}