function hook_views_preview_info_alter
Same name in other branches
- 8.9.x core/modules/views/views.api.php \hook_views_preview_info_alter()
- 10 core/modules/views/views.api.php \hook_views_preview_info_alter()
- 11.x core/modules/views/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 '#type' => 'table', containing information about the query and the display title and path.
- statistics: An array of rows suitable for '#type' => 'table', containing performance statistics.
\Drupal\views\ViewExecutable $view: The view object.
See also
Related topics
1 function implements hook_views_preview_info_alter()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- views_ui_test_views_preview_info_alter in core/
modules/ views_ui/ tests/ modules/ views_ui_test/ views_ui_test.module - Implements hook_views_preview_info_alter().
1 invocation of hook_views_preview_info_alter()
- ViewUI::renderPreview in core/
modules/ views_ui/ src/ ViewUI.php
File
-
core/
modules/ views/ views.api.php, line 916
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'][] = [
t('<strong>Table queue</strong>'),
count($view->query->table_queue) . ': (' . implode(', ', array_keys($view->query->table_queue)) . ')',
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.