is it possible to set a default value for a child node, e.g. main, when there is no value added yet? Just like defaultVaule for node properties? I’m thinking of something like:
if you are asking for some default nodes within a content collection, this should not be possible right now.
There were some discussions and ideas about some kind of node templates.
yes I was asking exactly that. Thanks for the reply. Is there any possible workaround?
The following code won’t work because content.main's value are some Neos wrapper div tags. Also: Is it possible to check, wheter the page is rendered inside the backend?
#f:if inNeosBackend?
<f:if condition="{content.main}">
<f:else>
<div class="alert alert-info" role="alert">Write text here . . .</div>
</f:else>
</f:if>
#/f:if
{content.main -> f:format.raw()}
doesn’t work my, unfortunately. main gets rendered in backend, but the children().count() condition seems to be wrong for frontend, because nothing gets rendered. What am I doing wrong?
Edit:
It seems that ${node.context.inBackend} is empty or unset or whatsoever when not in backend and hence the condition doesn’t work.
node.context.inBackend should be a boolean, I am not sure if Fluid will render that in any way. Try using it in an f:if condition to see if it works correctly.
Actually Fluid isn’t the problem. I mentioned this only for testing (Fluid seems to render true to 1 but false to an empty string). I don’t want main to be rendered when it doesn’t contain children, in order to avoid unused container tags in the output.
My problem is that main gets only rendered in backend although it contains children. I think I misunderstood something about the concept of @if or how to use it, because
a = FALSE
b = FALSE
c = 'yes'
c.@if.render = ${a || b}