You are here

protected function WebformMessageManager::getCustomMessage in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/WebformMessageManager.php \Drupal\webform\WebformMessageManager::getCustomMessage()

Get custom message.

Parameters

string $key: Message key.

array $arguments: An array with placeholder replacements, keyed by placeholder.

Return value

array|bool Renderable array or FALSE if custom message does not exist.

1 call to WebformMessageManager::getCustomMessage()
WebformMessageManager::get in src/WebformMessageManager.php
Get message.

File

src/WebformMessageManager.php, line 390

Class

WebformMessageManager
Defines the webform message (and login) manager.

Namespace

Drupal\webform

Code

protected function getCustomMessage($key, array $arguments = []) {
  $setting = $this
    ->getSetting($key);
  if (!$setting) {
    return FALSE;
  }

  // Replace tokens.
  $entity = $this->webformSubmission ?: $this->webform;
  $message = $this->tokenManager
    ->replace($setting, $entity);

  // Replace arguments.
  if ($arguments) {
    $message = str_replace('href="#"', 'href=":href"', $message);
    $message = new FormattableMarkup($message, $arguments);
  }
  return WebformHtmlEditor::checkMarkup($message);
}