Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
a custom function will allow you to access other services in the system, receive data, and check something.
for macro and include, all data should be ready.
macros are more convenient than includes for small things, such as inputs, because they can be placed in a bunch in one file and the syntax is simpler.
but doing everything with macros is bad - they are loaded every time, unlike includes, which are loaded only when necessary.
UPD to sum up, I would recommend
1) use custom twig functions when you need some kind of complex logic or request data from the system, but I would not recommend it for generating html, simply because html in php is not good. but in a custom function, you can call render of another template, this is normal, it can just worsen the search for layout for front-end developers (in the case of inclusion, everything is obvious for them).
2) macros - for a bunch of small things that are used often and everywhere (inputs)
3) includes for other cases, that is, when the data is already there and you need to format it in html
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question