olibur
(Oliver Burkhalter)
September 29, 2021, 2:21pm
1
Hi, I’m using the Neos.Fusion.Form:Runtime.RuntimeForm
and would like to render some data from the repository by getting the data with ${q(node).property('myLegendTitle')}
and use it in the AFX code in “content” property for the form body. But somehow it does not work. What I’m doing wrong?
Or is it also possible to use Translation texts? I have seen this https://github.com/neos/fusion-form/blob/master/Documentation/FusionReference.rst#neosfusionformfieldcontainer and according to the docs the label is translated with “translations.label.package” but I don’t understand yet how this can be used finally.
Thx for help!
Here the snippet:
renderer = Neos.Fusion.Form:Runtime.RuntimeForm {
namespace = 'contact'
process {
formLegendTitle = ${q(node).property('formLegendTitle')}
content = afx`
<fieldset>
<legend>{props.formLegendTitle}</legend>
...
</fieldset>
...
mficzel
(Martin Ficzel)
September 30, 2021, 12:30pm
2
Why not …
Runtime Form is not a Fusion:Component if you need props you can wrap it into one
prototype(Vendor.Site:ExampleForm) < prototype(Neos.Fusion:Component) {
formLegendTitle = ${q(node).property('formLegendTitle')}
renderer = Neos.Fusion.Form:Runtime.RuntimeForm {
namespace = 'contact'
process {
content = afx`
<fieldset>
<legend>{props.formLegendTitle}</legend>
...
</fieldset>
1 Like
olibur
(Oliver Burkhalter)
September 30, 2021, 1:56pm
3
Thanks @mficzel !
This was simple
The direct usage of q(node).property('formLegendTitle')
has worked.
But wrapping the form in a Fusion:Component did not work for me. Somehow the props
seems to be empty.
1 Like
mficzel
(Martin Ficzel)
September 30, 2021, 4:46pm
4
That is right and an unexpected side effect of the form beeing uncached by default.
Reason is that the cache annotation in https://github.com/neos/fusion-form/blob/master/Resources/Private/Fusion/Prototypes/Runtime/RuntimeForm.fusion ensures that only site, node and documentNode are persisted.
You could do this:
prototype(Vendor.Site:ExampleForm) < prototype(Neos.Fusion:Component) {
// then whole form component is made uncached
@cache {
mode = 'uncached'
context {
1 = 'node'
2 = 'documentNode'
3 = 'site'
}
}
formLegendTitle = ${q(node).property('formLegendTitle')}
renderer = Neos.Fusion.Form:Runtime.RuntimeForm {
// so the inner form can be embedded and share the props
@cache.mode = "embed"
namespace = 'contact'
process {
content = afx`
<fieldset>
<legend>{props.formLegendTitle}</legend>
2 Likes
olibur
(Oliver Burkhalter)
September 30, 2021, 7:16pm
5
Thanks for the explanation. With this using “props” worked also.