In my template I want to output the server timezone.
My template has something like
{{ getservertimezone }}
Then in the services.yml co
Use getFunctions()
instead of getFilters()
public function getFunctions()
{
return array(
new \Twig_SimpleFunction('server_time_zone', array($this, 'getServerTimeZone')),
);
}
Twig filters are used to filter some value.
{{ "some value" | filter_name_here }}
Btw, you can define both filters and functions in the same class.