You are here

public function WebformMessageManager::display in Webform 8.5

Same name and namespace in other branches
  1. 6.x 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 187

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);
  }
}