neos / form-builder

Flow Form Framework integration into Neos CMS
GNU General Public License v3.0
18 stars 31 forks source link

Can't use variables in properties.options of SingleSelectDropdown #124

Open marcelhecker opened 1 year ago

marcelhecker commented 1 year ago

I can't use variables or any expression with ${...} in a SingleSelectDropdown. While it works in labels or placeholders, there seems to be a problem with the options array. Only if I set the properties.options like man = 'Man' it works. Am I doing something wrong or is this an issue?

Example 1:

section1 = Neos.Form.Builder:Section.Definition { 
         required = ${false}
         elements {
                        salutation = Neos.Form.Builder:SingleSelectDropdown.Definition {
                            label = ${Translation.translate('Some.Package:NodeTypes.JobFormular:salutation')}
                            properties.options {
                                man = ${Translation.translate('Some.Package:NodeTypes.JobFormular:man')}
                                woman = ${Translation.translate('Some.Package:NodeTypes.JobFormular:woman')}
                                diverse = ${Translation.translate('Some.Package:NodeTypes.JobFormular:diverse')}
                            }
                            required = ${true}
                        }
           }
}

Example 2:

@propTypes {
        @strict = true
        translation = ${PropTypes.string}
    }

translation = 'test'

...

section1 = Neos.Form.Builder:Section.Definition { 
         required = ${false}
         elements {
                        salutation = Neos.Form.Builder:SingleSelectDropdown.Definition {
                            label = ${Translation.translate('Some.Package:NodeTypes.JobFormular:salutation')}
                            properties.options {
                                man = translation
                                woman = ${translation}
                            }
                            required = ${true}
                        }
           }
}

In all variants the following exception is thrown:

An exception was thrown while Neos tried to render your page
$optionValueField must be provided for array $options

root<Neos.Fusion:Case>/ documentType<Neos.Fusion:Matcher>/ element<Some.Package:Document.Job>/ body<Neos.Fusion:Component>/ content<Neos.Fusion:Join>/ main<Neos.Fusion:Component>/ renderer<Neos.Neos:ContentComponent>/ renderer<Neos.Fusion:Array>/ item_3<Another.Package:Molecule.Section>/ content<Neos.Fusion:Array>/ item_2<Some.Package:Meta.JobFormular>/ renderer<Neos.Form.Builder:Form>/