I'm having diffculties trying to find the right syntax for a multiple Twig filter expression.
I have a var called floatVar which is not always defined.
If it is defined, I would like to truncate this float to the third digit. If it is not defined, I would like to set an empty string.
I'm having trouble finding the proper syntax:
floatVar|number_format(3, '.','')|default('') // generates a Twig_Error_Runtime exception
floatVar|default('')|number_format(3, '.','') // output "0" in every case
(floatVar|number_format(3, '.',''))|default('') // generates a Twig_Error_Runtime exception
Could somebody point me in the right direction ? Is there a way to put paranthesis to explictly express the priority ? Any help or link to a related topic would be much appreciated.
Have a good day.