|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the BenGorUser package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Beñat Espiña <[email protected]> |
|
7
|
|
|
* (c) Gorka Laucirica <[email protected]> |
|
8
|
|
|
* |
|
9
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
10
|
|
|
* file that was distributed with this source code. |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
namespace BenGorUser\TwigBridgeBundle; |
|
14
|
|
|
|
|
15
|
|
|
use BenGorUser\UserBundle\DependentBenGorUserBundle; |
|
16
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
17
|
|
|
use Symfony\Component\HttpKernel\Bundle\Bundle; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Twig bridge bundle kernel class. |
|
21
|
|
|
* |
|
22
|
|
|
* @author Beñat Espiña <[email protected]> |
|
23
|
|
|
*/ |
|
24
|
|
|
class TwigBridgeBundle extends Bundle |
|
25
|
|
|
{ |
|
26
|
|
|
use DependentBenGorUserBundle; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* {@inheritdoc} |
|
30
|
|
|
*/ |
|
31
|
|
|
public function build(ContainerBuilder $container) |
|
32
|
|
|
{ |
|
33
|
|
|
$this->checkDependencies(['BenGorUserBundle', 'TwigBundle'], $container); |
|
34
|
|
|
|
|
35
|
|
|
$container->loadFromExtension('framework', [ |
|
36
|
|
|
'translator' => [ |
|
37
|
|
|
'paths' => [ |
|
38
|
|
|
$this->basePath() . '/Translations', |
|
39
|
|
|
], |
|
40
|
|
|
], |
|
41
|
|
|
]); |
|
42
|
|
|
$container->loadFromExtension('twig', [ |
|
43
|
|
|
'paths' => [ |
|
44
|
|
|
$this->basePath() . '/Twig/views' => 'bengor_user', |
|
45
|
|
|
], |
|
46
|
|
|
]); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* Gets the base path obtained via reflection, |
|
51
|
|
|
* agnostic to the Symfony root dir location. |
|
52
|
|
|
* |
|
53
|
|
|
* @return string |
|
54
|
|
|
*/ |
|
55
|
|
|
private function basePath() |
|
56
|
|
|
{ |
|
57
|
|
|
$directory = dirname((new \ReflectionClass(self::class))->getFileName()); |
|
58
|
|
|
|
|
59
|
|
|
return $directory . '/../../../../twig-bridge/src/BenGorUser/TwigBridge/Infrastructure/Ui'; |
|
60
|
|
|
} |
|
61
|
|
|
} |
|
62
|
|
|
|