public function Webform::getElement in Webform 8.5
Same name and namespace in other branches
- 6.x src/Entity/Webform.php \Drupal\webform\Entity\Webform::getElement()
Get a webform's initialized element.
Parameters
string $key: The element's key.
bool $include_children: Include initialized children.
Return value
array|null An associative array containing an initialized element.
Overrides WebformInterface::getElement
1 call to Webform::getElement()
- Webform::applyVariant in src/
Entity/ Webform.php - Apply webform variant.
File
- src/
Entity/ Webform.php, line 1827
Class
- Webform
- Defines the webform entity.
Namespace
Drupal\webform\EntityCode
public function getElement($key, $include_children = FALSE) {
$elements_flattened = $this
->getElementsInitializedAndFlattened();
$element = isset($elements_flattened[$key]) ? $elements_flattened[$key] : NULL;
if ($element && $include_children) {
$elements = $this
->getElementsInitialized();
return NestedArray::getValue($elements, $element['#webform_parents']);
}
else {
return $element;
}
}