1

I am using twig in a dynamic way to generate template and I want to show a twig variable that is stored in database (the value is {{entity.id}}).

    {%- for parameter in reportParameters%}
       {{ parameter.name }} : {{ parameter.value }}
     {%- endfor %}

The parameter.value should show 1 (the id of the current entity), but it shows {{entity.id}}

Is there equivalent to eval in php for twig?

1 Answer 1

1

Some kind folk are working on this extension at the minute but I don't think it's been pulled into the master branch yet. It looks as though we're going to have an "EvaluateString" twig function soon. Here it is:

https://github.com/fabpot/Twig-extensions/pull/53

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. I will integrate this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.