Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. views.api.php

function 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

Hooks
Define functions that alter the behavior of Drupal core.
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 92

Code

function hook_views_analyze(ViewExecutable $view) {
    $messages = [];
    if ($view->display_handler->options['pager']['type'] == 'none') {
        $messages[] = Analyzer::formatMessage(t('This view has no pager. This could cause performance issues when the view contains many items.'), 'warning');
    }
    return $messages;
}
RSS feed
Powered by Drupal