You are here

public function WebformMessageManager::display in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/WebformMessageManager.php \Drupal\webform\WebformMessageManager::display()

Display message.

Parameters

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'.

Overrides WebformMessageManagerInterface::display

File

src/WebformMessageManager.php, line 182

Class

WebformMessageManager
Defines the webform message (and login) manager.

Namespace

Drupal\webform

Code

public function display($key, $type = 'status') {
  if ($build = $this
    ->build($key)) {
    $this->messenger
      ->addMessage($this->renderer
      ->renderPlain($build), $type);
  }
}