diff options
Diffstat (limited to 'src/Wallabag/ImportBundle/DependencyInjection')
-rw-r--r-- | src/Wallabag/ImportBundle/DependencyInjection/Configuration.php | 27 | ||||
-rw-r--r-- | src/Wallabag/ImportBundle/DependencyInjection/WallabagImportExtension.php | 27 |
2 files changed, 54 insertions, 0 deletions
diff --git a/src/Wallabag/ImportBundle/DependencyInjection/Configuration.php b/src/Wallabag/ImportBundle/DependencyInjection/Configuration.php new file mode 100644 index 00000000..39df9d3f --- /dev/null +++ b/src/Wallabag/ImportBundle/DependencyInjection/Configuration.php | |||
@@ -0,0 +1,27 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\ImportBundle\DependencyInjection; | ||
4 | |||
5 | use Symfony\Component\Config\Definition\Builder\TreeBuilder; | ||
6 | use Symfony\Component\Config\Definition\ConfigurationInterface; | ||
7 | |||
8 | class Configuration implements ConfigurationInterface | ||
9 | { | ||
10 | public function getConfigTreeBuilder() | ||
11 | { | ||
12 | $treeBuilder = new TreeBuilder(); | ||
13 | $rootNode = $treeBuilder->root('wallabag_import'); | ||
14 | |||
15 | $rootNode | ||
16 | ->children() | ||
17 | ->arrayNode('allow_mimetypes') | ||
18 | ->prototype('scalar')->end() | ||
19 | ->end() | ||
20 | ->scalarNode('resource_dir') | ||
21 | ->end() | ||
22 | ->end() | ||
23 | ; | ||
24 | |||
25 | return $treeBuilder; | ||
26 | } | ||
27 | } | ||
diff --git a/src/Wallabag/ImportBundle/DependencyInjection/WallabagImportExtension.php b/src/Wallabag/ImportBundle/DependencyInjection/WallabagImportExtension.php new file mode 100644 index 00000000..3f23c36b --- /dev/null +++ b/src/Wallabag/ImportBundle/DependencyInjection/WallabagImportExtension.php | |||
@@ -0,0 +1,27 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\ImportBundle\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 | class WallabagImportExtension extends Extension | ||
11 | { | ||
12 | public function load(array $configs, ContainerBuilder $container) | ||
13 | { | ||
14 | $configuration = new Configuration(); | ||
15 | $config = $this->processConfiguration($configuration, $configs); | ||
16 | $container->setParameter('wallabag_import.allow_mimetypes', $config['allow_mimetypes']); | ||
17 | $container->setParameter('wallabag_import.resource_dir', $config['resource_dir']); | ||
18 | |||
19 | $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); | ||
20 | $loader->load('services.yml'); | ||
21 | } | ||
22 | |||
23 | public function getAlias() | ||
24 | { | ||
25 | return 'wallabag_import'; | ||
26 | } | ||
27 | } | ||