1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Fenrizbes\PublicationsBundle\DependencyInjection; |
4
|
|
|
|
5
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
6
|
|
|
use Symfony\Component\Config\FileLocator; |
7
|
|
|
use Symfony\Component\HttpKernel\DependencyInjection\Extension; |
8
|
|
|
use Symfony\Component\DependencyInjection\Loader; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* This is the class that loads and manages your bundle configuration |
12
|
|
|
* |
13
|
|
|
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html} |
14
|
|
|
*/ |
15
|
|
|
class FenrizbesPublicationsExtension extends Extension |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* {@inheritdoc} |
19
|
|
|
*/ |
20
|
|
|
public function load(array $configs, ContainerBuilder $container) |
21
|
|
|
{ |
22
|
|
|
$bundles = $container->getParameter('kernel.bundles'); |
23
|
|
|
|
24
|
|
|
$configuration = new Configuration(); |
25
|
|
|
$config = $this->processConfiguration($configuration, $configs); |
26
|
|
|
|
27
|
|
|
$container->setParameter('fp.date_format', $config['date_format']); |
28
|
|
|
$container->setParameter('fp.datetime_format', $config['datetime_format']); |
29
|
|
|
$container->setParameter('fp.sonata_admin.group_label', $config['sonata_admin']['group_label']); |
30
|
|
|
|
31
|
|
|
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
32
|
|
|
$loader->load('services.yml'); |
33
|
|
|
|
34
|
|
|
if (isset($bundles['SonataAdminBundle'])) { |
35
|
|
|
$loader->load('sonata_admin.yml'); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
if (is_null($config['sonata_admin']['content_editor']) && isset($bundles['IvoryCKEditorBundle'])) { |
39
|
|
|
$config['sonata_admin']['content_editor'] = 'ckeditor'; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
$container->setParameter('fp.sonata_admin.content_editor', $config['sonata_admin']['content_editor']); |
43
|
|
|
} |
44
|
|
|
} |
45
|
|
|
|