[ 
https://issues.apache.org/jira/browse/OFBIZ-12274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17374282#comment-17374282
 ] 

Daniel Watford edited comment on OFBIZ-12274 at 7/4/21, 1:36 PM:
-----------------------------------------------------------------

Hi [~dram],

I think what you are aiming for is being addressed by the MacroFormRenderer 
(slow going) refactoring effort in OFBIZ-11900 and its parent task OFBIZ-11456

In this case FtlWriter.processFtl accepts a RenderableFtl object which is 
responsible for rendering an FTL template string. The aim was for the bulk of 
MacroFormRender work to produce FTL template strings would be moved to helper 
classes like RenderableFtlFormElementsBuilder which would produce RenderableFtl 
objects. 

The work is slow going and takes time to construct tests to try and ensure no 
existing behaviour is accidently broken by the refactoring. But the goal is to 
have components responsible for creating RenderableFtl object decoupled from 
logic that actually writes FTL and processes that FTL in and environment to 
HTML.

If working on makeHyperlinkString, could you try refactoring to build a 
RenderableFtl object instead?



was (Author: danwatford):
Hi [~dram],

I think what you are aiming for is being addressed by the MacroFormRenderer 
(slow going) refactoring effort in OFBIZ-11900.

In this case FtlWriter.processFtl accepts a RenderableFtl object which is 
responsible for rendering an FTL template string. The aim was for the bulk of 
MacroFormRender work to produce FTL template strings would be moved to helper 
classes like RenderableFtlFormElementsBuilder which would produce RenderableFtl 
objects. 

The work is slow going and takes time to construct tests to try and ensure no 
existing behaviour is accidently broken by the refactoring. But the goal is to 
have components responsible for creating RenderableFtl object decoupled from 
logic that actually writes FTL and processes that FTL in and environment to 
HTML.

If working on makeHyperlinkString, could you try refactoring to build a 
RenderableFtl object instead?


> Add FtlWriter.processWithArgs
> -----------------------------
>
>                 Key: OFBIZ-12274
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-12274
>             Project: OFBiz
>          Issue Type: Improvement
>    Affects Versions: Trunk
>            Reporter: Xin Wang
>            Priority: Major
>
> When calling FTL macro from Java side is needed, instead of crafting a 
> template string with carefully escaping. with newly added 
> FtlWriter.processWithArgs,  we can pass parameters using an environment 
> variable, and then invoke macro with "with_args" builtin. With this approach, 
> it both makes cleaner code and free of fragile escaping.
> As an example, I also changes MacroFormRenderer.makeHyperlinkString to make 
> use of this new facility.
> I have created a GitHub PR for this: 
> https://github.com/apache/ofbiz-framework/pull/307



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to