F:render with optional parameter

servas,

i need to show dialogs depending on the id of a task. so i’d like to use the following:

<f:section name=“Content”>
<f:render partial="{taskId}" optional=“1” >
No Partial found for this task
</f:render>
</f:section>

but this does not work for me, i get an error if the file does not exist:
“The partial files “resource://xxxx/732.html”, “resource://xxx/732” could not be loaded.”

I noticed that <f:render section="{taskId}" optional=“1” /> seems to work, if i define some sections within the template file (but i cannot define 400+ sections within a file)

so in my opinion the optional-parameter does not have any effect for partials …

i modified the function getPartialPathAndFilename() in Packages/Framework/Neos.FluidAdaptor/Classes/View/TemplatePaths.php to add a default partialName, but i don’t think this is an appropiate solution :((

i noticed in a ViewHelper documentation the following argument description for debug:renderer
optional boolean
If TRUE, considers the section optional. Partial never is.

does this mean, that optional is not implemented for partial rendering???
Neos.Flow 8.1.1

ciao
H.

I don’t think rendering of a partial should ever be considered a optional thing - either you use it, or you dont :slight_smile:

What you are trying to solve, is a programmatically issue, in your view - and that’s where the issue comes up :slight_smile:

You should somehow determine, if there is a partial with such id in your controller and use that knowledge in your view. (assign it to the view with $this->view->assign('value', true))

Alternatively, bring some more details to your post. Partial is view specific naming - and your own domain model, might have a different naming and concept, that could fit better.

Conclusion, don’t make programmatically descissions in your view :slight_smile: