function public function Theme::getSetting

8.x-3.x Theme.php public Theme::getSetting($name, $default = NULL)

Retrieves a theme setting.


string $name: The name of the setting to be retrieved.

mixed $default: A default value to provide if the setting is not found or if the plugin does not have a "defaultValue" annotation key/value pair. Typically, you will likely never need to use this unless in rare circumstances where the setting plugin exists but needs a default value not able to be set by conventional means (e.g. empty array).

Return value

mixed The value of the requested setting, NULL if the setting does not exist and no $default value was provided.


Defines a theme object.



Source src/Theme.php (line 544)

public function getSetting($name, $default = NULL) {
  $value = $this->settings()->get($name);
  return !isset($value) ? $default : $value;