[SOLVED] Represent Nodes as Form-Radio-Buttons


(Burak Kavak) #1

I have a collection of date nodes obtained trough a FlowQuery:

dates = ${q(node).find('[My.Sitepackage:MyDate]').get()}

Let’s say this collection contains 3 date nodes, each with a start and end DateTime property.

I want to represent those DateTimes as radio buttons in my form (using overrideConfiguration presumably?)

overrideConfiguration = Neos.Fusion:RawArray {
    renderables = Neos.Fusion:RawArray {
        0 = Neos.Fusion:RawArray {
            renderables = Neos.Fusion:RawArray {
                0 = Neos.Fusion:RawArray {
                    type = 'Neos.Form:SingleSelectRadiobuttons'

                    properties = Neos.Fusion:RawArray {

                        options = Neos.Fusion:RawArray {
                            // ???
                        }
                    }
                }
            }
        }
    }
}

The result would be three radio buttons in my form. Something like this

  • 13.05.2019 - 17.05.2019
  • 20.05.2019 - 25.05.2019
  • 27.05.2019 - 31.05.2019

(Burak Kavak) #2

I found a solution to the problem: I wrote my own ‘Renderer’ fusion object like this and implemented it in PHP:

prototype(My.Sitepackage:DateRenderer).@class = 'My\\Sitepackage\\FusionObjects\\DateRendererImplementation'

Using a ‘RawCollection’ I can represent my nodes as radio buttons now:

overrideConfiguration = Neos.Fusion:RawArray {
    renderables = Neos.Fusion:RawArray {
        0 = Neos.Fusion:RawArray {
            renderables = Neos.Fusion:RawArray {
                0 = Neos.Fusion:RawArray {
                    type = 'Neos.Form:SingleSelectRadiobuttons'

                    properties = Neos.Fusion:RawArray {

                        options = Neos.Fusion:RawCollection {
                                collection = ${dates}
                                itemName = 'date'
                                itemRenderer = My.Sitepackage:DateRenderer {
                                    date = ${date}
                                }
                            }
                    }
                }
            }
        }
    }
}