-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
I have filters being loaded from both the official Text twig extension and a custom extension I've written, both configured via my config.yml:
services:
text.twig.extension:
class: Twig_Extensions_Extension_Text
tags: [{ name: twig.extension }]
custom_filter.twig.extension:
class: Project\Bundle\ExampleBundle\Extension\CustomFilterExtension
tags: [{ name: twig.extension }]
They are being used in normal twig templates without issue:
{% set myvar = "Lorem ipsum dolor sit amet, consectetur adipiscing elit." %}
{{ myvar|truncate(10) }}
{# prints "Lorem ipsu..." #}
However, trying to use them with the TwigstringBundle throws a Twig_Error_Syntax exception with a message of The filter "truncate" does not exist:
$this->get('twigstring')->render('{{ myvar|truncate(10) }}', array('myvar' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'));
Metadata
Metadata
Assignees
Labels
No labels