frctl / twig

Use Twig templates with Fractal.
32 stars 34 forks source link

Support data references in render tag. #31

Closed das-peter closed 4 years ago

das-peter commented 5 years ago

Use getContext() to fetch innerContext in order to trigger the data reference handling.

Chapabu commented 5 years ago

Is there an issue that supports this change? The code change looks fine, but with no background information on the PR (or a linked issue) I'm a bit apprehensive to merge.

das-peter commented 5 years ago

There's no issue yet. As for background info:
The documentation describes how to use data references but this doesn't work as documented if you use the render tag because the implementation accesses the context data directly instead using the available API - which is where the data reference handling is implemented. So in order to make the render tags data processing work as documented we need to slightly adjust the code of its implementation to use the available API.

Is that background enough? I don't have a simple example at hand atm. but if necessary could create something.

mihkeleidast commented 4 years ago

I tried to recreate the issue at https://github.com/risker/fractal-demo-project/tree/demo/pull-31

if i understood the problem correctly:

this does give me an error for rendering @c. unfortunately, the change in this PR does not fix the render error.

if i misunderstood the issue (and found another unrelated bug), could you provide an example that would be fixed by this change?

das-peter commented 4 years ago

@risker Thank you very much for your pro-active evaluation - much appreciated!