You are here

protected function WebformMessageManager::getSetting in Webform 6.x

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

Get message from webform specific setting or global setting.

Parameters

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

Return value

string|bool A message or FALSE when no message is found or the message is set to [none].

2 calls to WebformMessageManager::getSetting()
WebformMessageManager::build in src/WebformMessageManager.php
Build message.
WebformMessageManager::getCustomMessage in src/WebformMessageManager.php
Get custom message.

File

src/WebformMessageManager.php, line 355

Class

WebformMessageManager
Defines the webform message (and login) manager.

Namespace

Drupal\webform

Code

protected function getSetting($key) {
  $webform_settings = $this->webform ? $this->webform
    ->getSettings() : [];
  if (!empty($webform_settings[$key])) {
    $value = $webform_settings[$key];
    if ($value === '[none]' || $value === (string) $this
      ->t('[none]')) {
      return FALSE;
    }
    else {
      return $value;
    }
  }
  $default_settings = $this->configFactory
    ->get('webform.settings')
    ->get('settings');
  if (!empty($default_settings['default_' . $key])) {
    return $default_settings['default_' . $key];
  }
  return FALSE;
}