kuba
kuba

Reputation: 3870

Multiple Twig_Extension in Symfony2

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?

Upvotes: 3

Views: 439

Answers (1)

Broncha
Broncha

Reputation: 3794

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!

Upvotes: 6

Related Questions