Analyzer
class Analyzer (View source)
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.
Properties
| protected ModuleHandlerInterface | $moduleHandler | A module handler that invokes the 'views_analyze' hook. |
Methods
Formats the analyze result into a message string.
Formats an analysis message.
Details
__construct(ModuleHandlerInterface $module_handler)
Constructs an Analyzer object.
array
getMessages(ViewExecutable $view)
Analyzes a review and return the results.
formatMessages(array $messages)
Formats the analyze result into a message string.
This is based upon the format of \Drupal\Core\Messenger\MessengerInterface::addMessage() which uses separate boxes for "ok", "warning" and "error".
static array
formatMessage(string $message, string $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: