function ArrayElement::get
Same name in other branches
- 9 core/lib/Drupal/Core/Config/Schema/ArrayElement.php \Drupal\Core\Config\Schema\ArrayElement::get()
- 8.9.x core/lib/Drupal/Core/Config/Schema/ArrayElement.php \Drupal\Core\Config\Schema\ArrayElement::get()
- 10 core/lib/Drupal/Core/Config/Schema/ArrayElement.php \Drupal\Core\Config\Schema\ArrayElement::get()
Overrides TypedConfigInterface::get
1 call to ArrayElement::get()
- ArrayElement::getProperties in core/
lib/ Drupal/ Core/ Config/ Schema/ ArrayElement.php
File
-
core/
lib/ Drupal/ Core/ Config/ Schema/ ArrayElement.php, line 75
Class
- ArrayElement
- Defines a generic configuration element that contains multiple properties.
Namespace
Drupal\Core\Config\SchemaCode
public function get($name) {
$parts = explode('.', $name);
$root_key = array_shift($parts);
$elements = $this->getElements();
if (isset($elements[$root_key])) {
$element = $elements[$root_key];
// If $property_name contained a dot recurse into the keys.
while ($element && ($key = array_shift($parts)) !== NULL) {
if ($element instanceof TypedConfigInterface) {
$element = $element->get($key);
}
else {
$element = NULL;
}
}
}
if (isset($element)) {
return $element;
}
else {
throw new \InvalidArgumentException("The configuration property {$name} doesn't exist.");
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.