neos / form-builder

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

Allow inline editing of labels when used with Fusion rendering #29

Open Sebobo opened 6 years ago

Sebobo commented 6 years ago

As we previously discussed I think it would be a great feature to make the form labels (and maybe later other text) inline editable.

This would be part of a long term goal to make the already good form building even less "clicky" and less context switching.

As this should be fairly easy to implement in Fusion I would recommend to just implement it when the fusion renderer is being used. I would also assume that this will be the recommended form rendering in the future.

I tried implementing this but I'm currently unsure how to check in the form builder code if the renderer is the fusion renderer.

If I could override the fusion renderer prototypes from the form builder package It would still be standalone but would just add the functionality when both are being used together.

@bwaidelich can you give me a pointer where to start?

Thanks Sebastian

Sebobo commented 6 years ago

One mostly working way (problem with the required flag) to make the label editable is modifying the fusion based label like this:

prototype(Neos.Form.FusionRenderer:FormElementLabel) < prototype(Neos.Fusion:Tag) {
    tagName = 'label'
    attributes {
        for = ${element.uniqueIdentifier}
        for.@if.notEditable = ${!(element.renderingOptions._node && documentNode.context.inBackend)}
    }
    content = Neos.Fusion:Array {
        value = ${Neos.Form.translateAndEscapeProperty(element, 'label')}
        requiredFlag = Neos.Form.FusionRenderer:RequiredFlag
        requiredFlag.@if.isRequired = ${element.required}
    }

    @process.inlineEditable = Neos.Neos:ContentElementEditable {
        node = ${element.renderingOptions._node}
        property = 'label'
        @if.nodeBased = ${element.renderingOptions._node}
    }
}

The question is where to put this :)