forked from wallabag/wallabag
fix #1502 avoid duplicate entry and store pocket url in config
This commit is contained in:
committed by
Jeremy Benoist
parent
87f23b005c
commit
dda57bb944
@ -2,6 +2,7 @@
|
||||
|
||||
namespace Wallabag\ImportBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
|
||||
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
||||
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
||||
|
||||
@ -12,6 +13,22 @@ class Configuration implements ConfigurationInterface
|
||||
$treeBuilder = new TreeBuilder();
|
||||
$rootNode = $treeBuilder->root('wallabag_import');
|
||||
|
||||
$rootNode
|
||||
->children()
|
||||
->arrayNode('importers')
|
||||
->append($this->getURLs())
|
||||
->end()
|
||||
->end()
|
||||
;
|
||||
|
||||
return $treeBuilder;
|
||||
}
|
||||
|
||||
private function getURLs()
|
||||
{
|
||||
$node = new ArrayNodeDefinition('pocket_urls');
|
||||
$node->prototype('scalar')->end();
|
||||
|
||||
return $node;
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@ class WallabagImportExtension extends Extension
|
||||
{
|
||||
$configuration = new Configuration();
|
||||
$config = $this->processConfiguration($configuration, $configs);
|
||||
$container->setParameter('wallabag_import.pocket', $config['importers']['pocket_urls']);
|
||||
|
||||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||
$loader->load('services.yml');
|
||||
|
||||
Reference in New Issue
Block a user