Commit 3179dd42 authored by jhodgdon's avatar jhodgdon

Issue #1962704 by Eli-T, dawehner: Document hook_views_analyze()

parent be96e9dc
......@@ -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.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment