Drupal 8  8.0.2
Analyzer Class Reference

Public Member Functions

 __construct (ModuleHandlerInterface $module_handler)
 getMessages (ViewExecutable $view)
 formatMessages (array $messages)

Static Public Member Functions

static formatMessage ($message, $type= 'error')

Protected Attributes


Detailed Description

This tool is a small plugin manager to perform analysis on a view and report results to the user. This tool is meant to let modules that provide data to Views also help users properly use that data by detecting invalid configurations. Views itself comes with only a small amount of analysis tools, but more could easily be added either by modules or as patches to Views itself.

Constructor & Destructor Documentation

__construct ( ModuleHandlerInterface  $module_handler)

Constructs an Analyzer object.

\Drupal\Core\Extension\ModuleHandlerInterface$module_handlerThe module handler that invokes the 'views_analyze' hook.

References Drupal\moduleHandler().

Here is the call graph for this function:

Member Function Documentation

static formatMessage (   $message,
  $type = 'error' 

Formats an analysis message.

This tool should be called by any module responding to the analyze hook to properly format the message. It is usually used in the form:

$ret[] = Analyzer::formatMessage(t('This is the message'), 'ok');

The 'ok' status should be used to provide information about things that are acceptable. In general analysis isn't interested in 'ok' messages, but instead the 'warning', which is a category for items that may be broken unless the user knows what he or she is doing, and 'error' for items that are definitely broken are much more useful.

string$typeThe type of message. This should be "ok", "warning" or "error". Other values can be used but how they are treated by the output routine is undefined.
array A single formatted message, consisting of a key message and a key type.

Referenced by hook_views_analyze().

Here is the caller graph for this function:

formatMessages ( array  $messages)

Formats the analyze result into a message string.

This is based upon the format of drupal_set_message which uses separate boxes for "ok", "warning" and "error".

References t().

Here is the call graph for this function:

getMessages ( ViewExecutable  $view)

Analyzes a review and return the results.

\Drupal\views\ViewExecutable$viewThe view to analyze.
array An array of analyze results organized into arrays keyed by 'ok', 'warning' and 'error'.

References ViewExecutable\initDisplay(), and Drupal\moduleHandler().

Here is the call graph for this function:

The documentation for this class was generated from the following file: