merged branch tucksaun/patch-1 (PR #7952)
This PR was submitted for the 2.1 branch but it was merged into the master branch instead (closes #7952). Discussion ---------- [TwigBridge] Make getNodeVisitors call getTranslationNodeVisitor() | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Applies to | 2.1+ | Tests pass? | yes | Fixed tickets | N/A | License | MIT | Doc PR | N/A Commits ------- 20977e2 [TwigBridge] Eased translationNodeVisitor overriding in TranslationExtension
This commit is contained in:
commit
af4c9d6626
@ -28,10 +28,14 @@ class TranslationExtension extends \Twig_Extension
|
|||||||
private $translator;
|
private $translator;
|
||||||
private $translationNodeVisitor;
|
private $translationNodeVisitor;
|
||||||
|
|
||||||
public function __construct(TranslatorInterface $translator)
|
public function __construct(TranslatorInterface $translator, \Twig_NodeVisitorInterface $translationNodeVisitor = null)
|
||||||
{
|
{
|
||||||
|
if (!$translationNodeVisitor) {
|
||||||
|
$translationNodeVisitor = new TranslationNodeVisitor();
|
||||||
|
}
|
||||||
|
|
||||||
$this->translator = $translator;
|
$this->translator = $translator;
|
||||||
$this->translationNodeVisitor = new TranslationNodeVisitor();
|
$this->translationNodeVisitor = $translationNodeVisitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTranslator()
|
public function getTranslator()
|
||||||
|
Reference in New Issue
Block a user