Render options correctly
I debugged a little bit, why options are not rendered currently (as mentioned in #150). It seems that the Neos.Form.Builder:SelectOptionCollection/itemRenderer didn't fetched the properties, it just returns null which is stripped out by the implementation.
fixes #150
@dlubitz You had touched this implementation with #144 – can you judge whether this fix makes sense? To me it seems sensible, but I don't know all the implications
Thank you @Baachi for this PR. But this fix might work, but isn't correct at this place. The Neos.Form.Builder:SelectOptionCollection is not aware of the items it get's passed. This needs to be implemented on the using side.
See: https://github.com/neos/form-builder?tab=readme-ov-file#dynamic-options
In this case AFAIS it needs to be implemented here: https://github.com/neos/form-builder/blob/3ec4c7dd427082584a1430b647a8aea9c86becc3/Resources/Private/Fusion/NodeBased/NodeBasedFormElement.fusion#L15-L20
Hey people, can you ellaborate on the fix, please? Since @bwaidelich approach seems not to be correct?
What actually does need to be changed here
[email protected] = Neos.Form.Builder:SelectOptionCollection {
items = ${q(elementNode).children('options').children()}
valuePropertyPath = 'properties.value'
labelPropertyPath = 'properties.label'
@if.isSelectFormElement = ${q(elementNode).is('[instanceof Neos.Form.Builder:SelectionMixin]')}
}
to render the options again? Maybe I'm just stupid and don't get it right now (probably), but I really need the options to be rendered correctly again.
Hi @samsauter, have you alreday checked the docs: https://github.com/neos/form-builder?tab=readme-ov-file#dynamic-options
Instead of providing the property paths (valuePropertyPath, labelPropertyPath) you need to provide a itemRenderer. For example something like:
[email protected] = Neos.Form.Builder:SelectOptionCollection {
items = ${q(elementNode).children('options').children()}
itemRenderer = Neos.Fusion:DataStructure {
value = ${item.aggregateId}
label = ${q(item).property('title')}
}
@if.isSelectFormElement = ${q(elementNode).is('[instanceof Neos.Form.Builder:SelectionMixin]')}
}
(not tested)
Ahh! Well, it's certainly helpful to think for more than two seconds! Thank you!