You are here

public function BootstrapLayout::getSetting in Bootstrap Layouts 8.4

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

Retrieves a specific layout setting.

Parameters

string $name: The layout setting name. Can be dot notation to indicate a deeper key in the settings array.

mixed $default_value: The default value to use if layout setting does not exists.

Return value

mixed The layout setting value or $default_value if it does not exist.

File

src/BootstrapLayout.php, line 114

Class

BootstrapLayout
Class BootstrapLayout.

Namespace

Drupal\bootstrap_layouts

Code

public function getSetting($name, $default_value = NULL) {
  $parts = explode('.', $name);
  if (count($parts) === 1) {
    return isset($this->data['settings'][$name]) ? $this->data['settings'][$name] : $default_value;
  }
  $value = NestedArray::getValue($this->data['settings'], $parts, $key_exists);
  return $key_exists ? $value : NULL;
}