Skip to content

Commit

Permalink
Move Twig path initialization to loadConfiguration
Browse files Browse the repository at this point in the history
  • Loading branch information
enumag committed Sep 30, 2016
1 parent 6c2da4c commit 58e0753
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions src/DI/FormsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,14 @@ public function loadConfiguration()
->addTag(ValidatorExtension::TAG_LOADER);
}

if ($this->getExtension('Arachne\Twig\DI\TwigExtension', false)) {
$twigExtension = $this->getExtension('Arachne\Twig\DI\TwigExtension', false);
if ($twigExtension) {
$twigExtension->addPaths(
[
dirname((new ReflectionClass('Symfony\Bridge\Twig\AppVariable'))->getFileName()).'/Resources/views/Form',
]
);

$builder->addDefinition($this->prefix('twig.extension.translation'))
->setClass('Symfony\Bridge\Twig\Extension\TranslationExtension')
->addTag(TwigExtension::TAG_EXTENSION);
Expand All @@ -225,18 +232,6 @@ public function loadConfiguration()
}
}

public function beforeCompile()
{
$twigExtension = $this->getExtension('Arachne\Twig\DI\TwigExtension', false);
if ($twigExtension) {
$twigExtension->addPaths(
[
dirname((new ReflectionClass('Symfony\Bridge\Twig\AppVariable'))->getFileName()).'/Resources/views/Form',
]
);
}
}

/**
* @param string $class
* @param bool $need
Expand Down

0 comments on commit 58e0753

Please sign in to comment.