public function WebformMessageManager::append in Webform 8.5
Same name and namespace in other branches
- 6.x src/WebformMessageManager.php \Drupal\webform\WebformMessageManager::append()
Append inline message message to a render array.
Parameters
array $build: A render array.
string $key: The name of webform settings message to be displayed.
string $type: (optional) The message's type. Defaults to 'status'. These values are supported:
- 'status'.
- 'warning'.
- 'error'.
Return value
array The render array with webform inline message appended.
Overrides WebformMessageManagerInterface::append
File
- src/
WebformMessageManager.php, line 170
Class
- WebformMessageManager
- Defines the webform message (and login) manager.
Namespace
Drupal\webformCode
public function append(array $build, $key, $type = 'status') {
$message = $this
->build($key);
if ($message) {
// Append namespace message and allow for multiple messages.
$build['webform_message'][] = [
'#type' => 'webform_message',
'#message_message' => $message,
'#message_type' => $type,
'#weight' => -100,
];
}
return $build;
}