Skip to content

Conversation

@Baachi
Copy link

@Baachi Baachi commented Aug 27, 2025

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

@bwaidelich
Copy link
Member

@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

@dlubitz
Copy link
Contributor

dlubitz commented Sep 5, 2025

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:

properties.options.@process.overrideFromNode = 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]')}
}

Copy link
Contributor

@dlubitz dlubitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above

@samsauter
Copy link
Contributor

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

properties.options.@process.overrideFromNode = 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.

@dlubitz
Copy link
Contributor

dlubitz commented Nov 27, 2025

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:

properties.options.@process.overrideFromNode = 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)

@samsauter
Copy link
Contributor

Ahh! Well, it's certainly helpful to think for more than two seconds! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Options aren't rendered

4 participants