You are here

public function Webform::getSetting in Webform 8.5

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

Returns the webform settings for a given key.

Parameters

string $key: The key of the setting to retrieve.

bool $default: Flag to lookup the default settings from 'webform.settings' config. Only used when rendering webform.

Return value

mixed The settings value, or NULL if no settings exists.

Overrides WebformInterface::getSetting

8 calls to Webform::getSetting()
Webform::buildPages in src/Entity/Webform.php
Build and cache a webform's wizard pages based on the current operation.
Webform::getCacheContexts in src/Entity/Webform.php
The cache contexts associated with this object.
Webform::getPages in src/Entity/Webform.php
Get webform wizard pages.
Webform::hasPreview in src/Entity/Webform.php
Determine if the webform has preview page.
Webform::hasRemoteAddr in src/Entity/Webform.php
Determine if remote IP address is being stored.

... See full list

File

src/Entity/Webform.php, line 989

Class

Webform
Defines the webform entity.

Namespace

Drupal\webform\Entity

Code

public function getSetting($key, $default = FALSE) {
  $settings = $this
    ->getSettings();
  $value = isset($settings[$key]) ? $settings[$key] : NULL;
  if ($default) {
    return $value ?: \Drupal::config('webform.settings')
      ->get('settings.default_' . $key);
  }
  else {
    return $value;
  }
}