public function WebformCompositeBase::getElementSelectorSourceValues in Webform 6.x
Same name and namespace in other branches
- 8.5 src/Plugin/WebformElement/WebformCompositeBase.php \Drupal\webform\Plugin\WebformElement\WebformCompositeBase::getElementSelectorSourceValues()
Get an element's selectors source values.
Parameters
array $element: An element.
Return value
array An array of element selectors source values.
Overrides WebformElementBase::getElementSelectorSourceValues
See also
\Drupal\webform\Entity\Webform::getElementsSelectorSourceValues
File
- src/
Plugin/ WebformElement/ WebformCompositeBase.php, line 313
Class
- WebformCompositeBase
- Provides a base for composite elements.
Namespace
Drupal\webform\Plugin\WebformElementCode
public function getElementSelectorSourceValues(array $element) {
if ($this
->hasMultipleValues($element)) {
return [];
}
$name = $element['#webform_key'];
$source_values = [];
$composite_elements = $this
->getInitializedCompositeElement($element);
foreach ($composite_elements as $composite_key => $composite_element) {
if (Element::isVisibleElement($composite_elements) && isset($composite_element['#type'])) {
$element_plugin = $this->elementManager
->getElementInstance($composite_element);
$composite_element['#webform_key'] = "{$name}[{$composite_key}]";
$source_values += $element_plugin
->getElementSelectorSourceValues($composite_element);
}
}
return $source_values;
}