public function MappingEditFormBase::prepareOptions in GatherContent 8.4
Same name and namespace in other branches
- 8.5 gathercontent_ui/src/Form/MappingEditFormBase.php \Drupal\gathercontent_ui\Form\MappingEditFormBase::prepareOptions()
Prepare options for every language for every field.
Parameters
\Cheppers\GatherContent\DataTypes\Template $template: GatherContent template object.
Return value
array Array with options.
1 call to MappingEditFormBase::prepareOptions()
- MappingEditForm::submitForm in gathercontent_ui/
src/ Form/ MappingEditForm.php - This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form state…
File
- gathercontent_ui/
src/ Form/ MappingEditFormBase.php, line 227
Class
- MappingEditFormBase
- Class MappingEditFormBase.
Namespace
Drupal\gathercontent_ui\FormCode
public function prepareOptions(Template $template) {
$options = [];
foreach ($this->entityReferenceFields as $field => $gcMapping) {
foreach ($gcMapping as $lang => $fieldSettings) {
foreach ($template->config as $tab) {
if ($tab->id === $fieldSettings['tab']) {
foreach ($tab->elements as $element) {
if ($element->id === $fieldSettings['name']) {
foreach ($element->options as $option) {
if (!isset($option['value'])) {
$options[$option['name']] = $option['label'];
}
}
}
}
}
}
}
}
return $options;
}