hook_views_analyze

hook_views_analyze(Drupal\views\ViewExecutable $view)

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.

File

core/modules/views/views.api.php, line 95
Describes hooks and plugins provided by the Views module.

Code

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;
}
doc_Drupal
2016-10-29 09:18:37
Comments
Leave a Comment

Please login to continue.