Is it possible to use the macros defined in DefaultScreenMacros.hmlt.ftl directly in others ftl?
I have made a custom component in Moqui, and I used ftls for templating, I wanted to use <@text\-line>
to insert an autocomplete field into an ftl but it doesn't seem to work.
I suspect that the ftls doesn't automatically include DefaultScreenMacros.hmlt.ftl , I tried to include it manually like this:
<#include "classpath://moqui/runtime/template/screen-macro/DefaultScreenMacros.html.ftl"/>
but still no joy. Any clues?
@ddekany You are right, and I figure that one out. That's one problem and is on the moqui part. The path is correct but I am unsure if it is on the classpath. Anyway if I add all the macros in the flt file (or if I put a local valid classpath) then I when I call them like <@someMacro> they will fail because those macros are made to process xml not ftls. For example this macro:
<#macro container>
<#assign divId><@nodeId .node/></#assign>
<${.node["@type"]!"div"}<#if divId?has_content> id="${divId}"</#if><#if .node["@style"]?has_content> class="${ec.resource.expand(.node["@style"], "")}"</#if>>
<#recurse>
</${.node["@type"]!"div"}>
</#macro>
Will process xml like:
<container id="test">
</container>
And produce this:
<div id="test">
</div>
Bu if I call from within a ftl containing that macro like this:
<@container id="test">
</@container>
I get:
[Template Error: Macro "container" has no parameter with name "id". ---- FTL stack trace ("~" means nesting-related): - Failed at: #macro container [in template ...
Is there a way to call it in the ftl without changing tha macro?