1.3 KiB
DigiComp.FluidRenderFunctions
Quickstart
This Package provides you with the possibility to register render functions, created from them, to use them dynamically else where.
Let me show you the idea:
<f:form.select options="{books}" />
Assuming you know how the SelectViewHelper works, you know, you can provide an "optionLabelField"-argument to adivce the ViewHelper to use a property of your options. But, what if you want to use a complete template, to display your books? FluidRenderFunctions to the rescue:
<rf:registerRenderFunction as="renderBook" subjectName="myBook">
{myBook.name} from {myBook.author.name}
</rf:registerRenderFunction>
<f:form.select options="{books -> rf:applyRenderFunction(function: 'renderBook')}" />
To make your live easier, FluidRenderFunctions augments the original SelectViewHelper
and the TextfieldViewHelper
with an optional renderFunction
argument. That way, you can even use the usual Textfield to display formatted Datetime objects. Neat!
Configuration
If - for whatever reason - you do not want FluidRenderFunctions to augment the original ViewHelpers you can opt out by setting DigiComp.FluidRenderFunctions.enableAspects.select
or DigiComp.FluidRenderFunctions.enableAspects.textfield
to false
.