function hook_views_analyze

Same name and namespace in other branches
  1. 8.9.x core/modules/views/views.api.php \hook_views_analyze()
  2. 10 core/modules/views/views.api.php \hook_views_analyze()
  3. 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

6 functions implement hook_views_analyze()

Note: the procedural functions in this list are found by pattern matching, so the list may include some functions that are not actually implementations of this hook.

NodeViewsHooks::viewsAnalyze in core/modules/node/src/Hook/NodeViewsHooks.php
Implements hook_views_analyze().
node_views_analyze in core/modules/node/node.views.inc
Implements hook_views_analyze().
ViewsTestDataViewsHooks::viewsAnalyze in core/modules/views/tests/modules/views_test_data/src/Hook/ViewsTestDataViewsHooks.php
Implements hook_views_analyze().
ViewsUiHooks::viewsAnalyze in core/modules/views_ui/src/Hook/ViewsUiHooks.php
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().

... See full list

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.