Fusion-Case with Class

Hey,

I want to use a custom class for the Neos.Form.Builder:Form if a Property is true.

Is there is somethin like:

 @class = Neos.Fusion:Case {
    useCustomClass {
        condition = ${q(node).property('useCustom')}
        renderer = 'Vendor\\Package\\Fusion\\QuizFormImplementation'
    }
    
    else {
        condition = true
        renderer = 'Neos\\Form\\Builder\\Fusion\\FormImplementation'
    }
}

Would be nice if I can check that.

a bit late to the party, but i would like to clear this up ^^

this is not possible as @class expects a simple string. Not even EEL is allowed:

im not saying it cant be implemented, but i think there is to little demand for it, to justify this :grin:

in your case, i would extend the FormImplementation to only have one class which takes care of it all.

…that or just move the case one level up, like:

prototype(Your:Component) < prototype(Neos.Fusion:Component) {
  renderer = Neos.Fusion:Case {
    useCustom {
        condition = ${q(node).property('useCustom')}
        renderer = Your:QuizFormImplementation
    }
    default {
        condition = true
        renderer = Your:DefaultImplementation
    } 
  }
}
prototype(Your:QuizFormImplementation) {
  @class = 'Vendor\\Package\\Fusion\\QuizFormImplementation'
}
prototype(Your:DefaultImplementation) {
  @class = 'Neos\\Form\\Builder\\Fusion\\FormImplementation'
}

(untested)

1 Like