-
Notifications
You must be signed in to change notification settings - Fork 23
/
FSiAdminBundle.php
48 lines (40 loc) · 1.58 KB
/
FSiAdminBundle.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* (c) FSi sp. z o.o. <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace FSi\Bundle\AdminBundle;
use FSi\Bundle\AdminBundle\DependencyInjection\Compiler\FlashMessagesPass;
use FSi\Bundle\AdminBundle\DependencyInjection\Compiler\ResourceRepositoryPass;
use FSi\Bundle\AdminBundle\DependencyInjection\Compiler\TwigGlobalsPass;
use FSi\Bundle\AdminBundle\DependencyInjection\FSIAdminExtension;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class FSiAdminBundle extends Bundle
{
public function build(ContainerBuilder $container): void
{
$container->addCompilerPass(new FlashMessagesPass());
$container->addCompilerPass(new ResourceRepositoryPass());
$container->addCompilerPass(new TwigGlobalsPass());
if (
true === $container->hasExtension('fsi_translatable')
&& true === $container->hasExtension('fsi_resource_repository')
) {
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/Resources/config'));
$loader->load('resource_repository_translatable.xml');
}
}
public function getContainerExtension(): FSIAdminExtension
{
if (null === $this->extension) {
$this->extension = new FSIAdminExtension();
}
return $this->extension;
}
}