From 3179dd42b8405aa743638071a743abd4a8555726 Mon Sep 17 00:00:00 2001 From: Jennifer Hodgdon Date: Wed, 26 Jun 2013 13:31:31 -0700 Subject: [PATCH] Issue #1962704 by Eli-T, dawehner: Document hook_views_analyze() --- core/modules/views/views.api.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/core/modules/views/views.api.php b/core/modules/views/views.api.php index 6b4245b782..3001caa0bd 100644 --- a/core/modules/views/views.api.php +++ b/core/modules/views/views.api.php @@ -97,6 +97,26 @@ * Hooks that allow other modules to implement the Views API. */ +/** + * Analyze a view to provide warnings about its configuration. + * + * @param \Drupal\views\ViewExecutable $view + * The view being executed. + * + * @return array + * Array of warning messages built by Analyzer::formatMessage to be displayed + * to the user following analysis of the view. + */ +function hook_views_analyze(Drupal\views\ViewExecutable $view) { + $messages = array(); + + 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; +} + /** * Describe data tables (or the equivalent) to Views. * -- GitLab