title: Using a custom function in Twig
body: <p>In my template I want to output the server timezone.</p>
  <p>My template has something like</p>
  <pre><code>{{ getservertimezone }}
  </code></pre>
  <p>Then in the <code>services.yml</code> config for that bundle I have</p>
  <pre><code>my.twig.extension:
      class: My\WebsiteBundle\Extensions\Twig\SomeTemplateHelper
      tags:
             - { name: twig.extension }
  </code></pre>
  <p>And my <code>SomeTemplateHelper</code> looks like</p>
  <pre><code>namespace My\WebsiteBundle\Extensions\Twig;
  
  class SomeTemplateHelper extends \Twig_Extension
  {
  
      public function getFilters() 
      {
          return array(
              'getservertimezone'  =&gt; new \Twig_Filter_Method($this, 'getServerTimeZone'),
          );
      }
  
      
      public function getServerTimeZone()
      {
          if (date_default_timezone_get()) {
              return date_default_timezone_get();
          } else if (ini_get('date.timezone')) {
              return ini_get('date.timezone');
          } else {
              return false;
          }
      }
  
      public function getName()
      {
          return 'some_helper';
      }
      
  }
  </code></pre>
  <p>But I can't call this method unless it's used like a filter: <code>{{ someval | getservertimezone  }}</code>; is there a way to just do a straight <code>{{ getservertimezone() }}</code> call?</p>