public function YamlFormElementBase::getElementSelectorOptions in YAML Form 8
Get an element's selectors as options.
Parameters
array $element: An element.
Return value
array An array of element selectors.
Overrides YamlFormElementInterface::getElementSelectorOptions
11 methods override YamlFormElementBase::getElementSelectorOptions()
- ContainerBase::getElementSelectorOptions in src/
Plugin/ YamlFormElement/ ContainerBase.php - Get an element's selectors as options.
- Table::getElementSelectorOptions in src/
Plugin/ YamlFormElement/ Table.php - Get an element's selectors as options.
- TableSelect::getElementSelectorOptions in src/
Plugin/ YamlFormElement/ TableSelect.php - Get an element's selectors as options.
- Value::getElementSelectorOptions in src/
Plugin/ YamlFormElement/ Value.php - Get an element's selectors as options.
- YamlFormCheckboxesOther::getElementSelectorOptions in src/
Plugin/ YamlFormElement/ YamlFormCheckboxesOther.php - Get an element's selectors as options.
File
- src/
YamlFormElementBase.php, line 849
Class
- YamlFormElementBase
- Provides a base class for a form element.
Namespace
Drupal\yamlformCode
public function getElementSelectorOptions(array $element) {
$title = $this
->getAdminLabel($element) . ' [' . $this
->getPluginLabel() . ']';
$name = $element['#yamlform_key'];
if ($inputs = $this
->getElementSelectorInputsOptions($element)) {
$selectors = [];
foreach ($inputs as $input_name => $input_title) {
$selectors[":input[name=\"{$name}[{$input_name}]\"]"] = $input_title;
}
return [
$title => $selectors,
];
}
else {
return [
":input[name=\"{$name}\"]" => $title,
];
}
}