You are here

static function Analyzer::formatMessage in Views (for Drupal 7) 8.3

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.

Parameters

string $message:

string $type: The 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.

Return value

array A single formatted message, consisting of a key message and a key type.

3 calls to Analyzer::formatMessage()
Analyzer::formatMessages in lib/Drupal/views/Analyzer.php
Formats the analyze result into a message string.
node_views_analyze in modules/node.views.inc
Implements hook_views_analyze().
views_ui_views_analyze in views_ui/views_ui.module
Implements hook_views_analyze().

File

lib/Drupal/views/Analyzer.php, line 127
Definition of Drupal\views\Analyzer.

Class

Analyzer
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…

Namespace

Drupal\views

Code

static function formatMessage($message, $type = 'error') {
  return array(
    'message' => $message,
    'type' => $type,
  );
}