1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the jquery-datatables-bundle package. |
5
|
|
|
* |
6
|
|
|
* (c) 2018 WEBEWEB |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace WBW\Bundle\JQuery\DataTablesBundle\DependencyInjection; |
13
|
|
|
|
14
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
15
|
|
|
use Symfony\Component\Config\FileLocator; |
16
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
17
|
|
|
use Symfony\Component\DependencyInjection\Extension\Extension; |
18
|
|
|
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; |
19
|
|
|
use Throwable; |
20
|
|
|
use WBW\Bundle\CoreBundle\Config\ConfigurationHelper; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* jQuery DataTables extension. |
24
|
|
|
* |
25
|
|
|
* @author webeweb <https://github.com/webeweb> |
26
|
|
|
* @package WBW\Bundle\JQuery\DataTablesBundle\DependencyInjection |
27
|
|
|
*/ |
28
|
|
|
class WBWJQueryDataTablesExtension extends Extension { |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Extension alias. |
32
|
|
|
* |
33
|
|
|
* @var string |
34
|
|
|
*/ |
35
|
|
|
const EXTENSION_ALIAS = "wbw_jquery_datatables"; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* {@inheritDoc} |
39
|
|
|
*/ |
40
|
|
|
public function getAlias(): string { |
41
|
|
|
return self::EXTENSION_ALIAS; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* {@inheritDoc} |
46
|
|
|
* @param array<string,mixed> $configs The configurations. |
47
|
|
|
* @throws Throwable Throws an exception if an error occurs. |
48
|
|
|
*/ |
49
|
|
|
public function load(array $configs, ContainerBuilder $container): void { |
50
|
|
|
|
51
|
|
|
$fileLocator = new FileLocator(__DIR__ . "/../Resources/config"); |
52
|
|
|
|
53
|
|
|
$serviceLoader = new YamlFileLoader($container, $fileLocator); |
54
|
|
|
$serviceLoader->load("commands.yml"); |
55
|
|
|
$serviceLoader->load("controllers.yml"); |
56
|
|
|
$serviceLoader->load("managers.yml"); |
57
|
|
|
$serviceLoader->load("twig.yml"); |
58
|
|
|
|
59
|
|
|
/** @var ConfigurationInterface $configuration */ |
60
|
|
|
$configuration = $this->getConfiguration($configs, $container); |
61
|
|
|
|
62
|
|
|
$config = $this->processConfiguration($configuration, $configs); |
63
|
|
|
|
64
|
|
|
ConfigurationHelper::registerContainerParameter($container, $config, $this->getAlias(), "theme"); |
65
|
|
|
ConfigurationHelper::registerContainerParameter($container, $config, $this->getAlias(), "plugins"); |
66
|
|
|
|
67
|
|
|
$assets = ConfigurationHelper::loadYamlConfig(__DIR__, "assets"); |
68
|
|
|
ConfigurationHelper::registerContainerParameters($container, $assets["assets"]); |
69
|
|
|
} |
70
|
|
|
} |
71
|
|
|
|