In previous versions of Symfony2, to enable a extension you needed to add the Text and/or Debug extensions to an "extensions" array in your config.yml
//app/config/config.yml # Twig Configuration twig: debug: %kernel.debug% strict_variables: %kernel.debug% extensions: - twig.extension.debug - twig.extension.text
This was because the extensions were added to the twig.xml file
//vendor/symfony/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml ......
But, this is the way to do it now :
// app/config/config.yml ... services: twig.extension.text: class: Twig_Extensions_Extension_Text tags: - { name: twig.extension }
devtime: How to enable the twig truncate filter (Text extension) in Symfony2 beta5
More than 3 requests, I'll translate this to Chinese.
超过3个请求,我就会把这篇文章翻译成中文。
No comments:
Post a Comment