3

I want to register my custom Twig filters in separate bundle (to avoid having one huge file).

I have Yaml configurations in each bundle:

# services.yml
services:
    twig.extension.[BundleName]:
        class: Kuba\[BundleName]\Twig\AppExtension
        public: false
        tags:
            - { name: twig.extension }

Yet, all the time the last (lexicographically) extension overrides previous one.

How can I register more than one extension and if it's not possible what would be de best practise to split the code?

kuba
  • 3,670
  • 3
  • 31
  • 41

1 Answers1

6

Twig extensions are identified by the string returned by getName() method. Is there a reason you have to return same string in all your twig extension!

Broncha
  • 3,794
  • 1
  • 24
  • 34