function Analyzer::formatMessage
Same name in other branches
- 9 core/modules/views/src/Analyzer.php \Drupal\views\Analyzer::formatMessage()
- 8.9.x core/modules/views/src/Analyzer.php \Drupal\views\Analyzer::formatMessage()
- 11.x core/modules/views/src/Analyzer.php \Drupal\views\Analyzer::formatMessage()
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 they are doing, and 'error' for items that are definitely broken are much more useful.
Parameters
string $message: The 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.
5 calls to Analyzer::formatMessage()
- Analyzer::formatMessages in core/
modules/ views/ src/ Analyzer.php - Formats the analyze result into a message string.
- hook_views_analyze in core/
modules/ views/ views.api.php - Analyze a view to provide warnings about its configuration.
- node_views_analyze in core/
modules/ node/ node.views.inc - Implements hook_views_analyze().
- views_test_data_views_analyze in core/
modules/ views/ tests/ modules/ views_test_data/ views_test_data.views.inc - Implements hook_views_analyze().
- views_ui_views_analyze in core/
modules/ views_ui/ views_ui.module - Implements hook_views_analyze().
File
-
core/
modules/ views/ src/ Analyzer.php, line 121
Class
- Analyzer
- View analyzer plugin manager.
Namespace
Drupal\viewsCode
public static function formatMessage($message, $type = 'error') {
return [
'message' => $message,
'type' => $type,
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.