Answer the question
In order to leave comments, you need to log in
How to add custom function to twig?
How can I create a function for twig that can pass parameters?
For example, in the template: {{ phrase('save') }}
And in the code, this function will be like this:
function phrase ($pharse_data) {
...
}
Answer the question
In order to leave comments, you need to log in
You need to create an extension for Twig and implement the function there. See https://twig.symfony.com/doc/2.x/advanced.html#id2
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question