This repository was archived by the owner on Feb 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 239
Expand file tree
/
Copy pathSgDatatablesExtension.php
More file actions
65 lines (56 loc) · 1.91 KB
/
Copy pathSgDatatablesExtension.php
File metadata and controls
65 lines (56 loc) · 1.91 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/**
* This file is part of the SgDatatablesBundle package.
*
* (c) stwe <https://github.com/stwe/DatatablesBundle>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sg\DatatablesBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
/**
* Class SgDatatablesExtension
*
* @package Sg\DatatablesBundle\DependencyInjection
*/
class SgDatatablesExtension extends Extension implements PrependExtensionInterface
{
/**
* {@inheritDoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml');
$container->setParameter('sg_datatables.datatable.query', $config['datatable']['query']);
$bundles = $container->getParameter('kernel.bundles');
if(isset($bundles['MakerBundle'])) {
$loader->load('maker.yml');
}
}
/**
* {@inheritDoc}
*/
public function prepend(ContainerBuilder $container)
{
$container->prependExtensionConfig(
'framework',
array(
'assets' => array(
'packages' => array(
'datatables_cdn' => array(
'base_url' => 'https://cdn.datatables.net/plug-ins/1.10.13/i18n/',
),
),
),
)
);
}
}