function hook_views_analyze
Same name in other branches
- 8.9.x core/modules/views/views.api.php \hook_views_analyze()
- 10 core/modules/views/views.api.php \hook_views_analyze()
- 11.x core/modules/views/views.api.php \hook_views_analyze()
Analyze a view to provide warnings about its configuration.
Parameters
\Drupal\views\ViewExecutable $view: The view being executed.
Return value
array Array of warning messages built by Analyzer::formatMessage to be displayed to the user following analysis of the view.
Related topics
3 functions implement hook_views_analyze()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- node_views_analyze in core/
modules/ node/ node.views.inc - Implements hook_views_analyze().
- views_test_data_views_analyze in core/
modules/ views/ tests/ modules/ views_test_data/ views_test_data.views.inc - Implements hook_views_analyze().
- views_ui_views_analyze in core/
modules/ views_ui/ views_ui.module - Implements hook_views_analyze().
1 invocation of hook_views_analyze()
- Analyzer::getMessages in core/
modules/ views/ src/ Analyzer.php - Analyzes a review and return the results.
File
-
core/
modules/ views/ views.api.php, line 87
Code
function hook_views_analyze(\Drupal\views\ViewExecutable $view) {
$messages = [];
if ($view->display_handler->options['pager']['type'] == 'none') {
$messages[] = Drupal\views\Analyzer::formatMessage(t('This view has no pager. This could cause performance issues when the view contains many items.'), 'warning');
}
return $messages;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.