You are here

public function YamlFormMessageManager::display in YAML Form 8

Display message.

Parameters

string $key: The name of form settings message to be displayed.

string $type: (optional) The message's type. Defaults to 'status'. These values are supported:

  • 'status'.
  • 'warning'.
  • 'error'.

Return value

bool TRUE if message was displayed.

Overrides YamlFormMessageManagerInterface::display

File

src/YamlFormMessageManager.php, line 143

Class

YamlFormMessageManager
Defines the form message (and login) manager.

Namespace

Drupal\yamlform

Code

public function display($key, $type = 'status') {
  if ($build = $this
    ->build($key)) {
    drupal_set_message(\Drupal::service('renderer')
      ->renderPlain($build), $type);
    return TRUE;
  }
  else {
    return FALSE;
  }
}