1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-08-31 18:31:02 +00:00

Use parameters directly instead of bundle config

This commit is contained in:
Yassine Guedidi 2024-02-19 00:58:19 +01:00
parent 6879bb2435
commit 09ef700fda
3 changed files with 22 additions and 119 deletions

View file

@ -9,80 +9,6 @@ class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('wallabag_core');
$rootNode = $treeBuilder->getRootNode();
$rootNode
->children()
->arrayNode('languages')
->prototype('scalar')->end()
->end()
->integerNode('items_on_page')
->defaultValue(12)
->end()
->scalarNode('language')
->defaultValue('en')
->end()
->integerNode('rss_limit')
->defaultValue(50)
->end()
->integerNode('reading_speed')
->defaultValue(200)
->end()
->scalarNode('version')
->end()
->scalarNode('paypal_url')
->end()
->integerNode('cache_lifetime')
->defaultValue(10)
->end()
->scalarNode('fetching_error_message')
->end()
->scalarNode('fetching_error_message_title')
->end()
->scalarNode('action_mark_as_read')
->defaultValue(1)
->end()
->scalarNode('list_mode')
->defaultValue(1)
->end()
->scalarNode('display_thumbnails')
->defaultValue(1)
->end()
->scalarNode('api_limit_mass_actions')
->defaultValue(10)
->end()
->arrayNode('default_internal_settings')
->prototype('array')
->children()
->scalarNode('name')->end()
->scalarNode('value')->end()
->enumNode('section')
->values(['entry', 'misc', 'api', 'analytics', 'export', 'import'])
->end()
->end()
->end()
->end()
->scalarNode('encryption_key_path')
->end()
->arrayNode('default_ignore_origin_instance_rules')
->prototype('array')
->children()
->scalarNode('rule')->end()
->end()
->end()
->end()
->arrayNode('fonts')
->prototype('scalar')->end()
->end()
->arrayNode('allow_mimetypes')
->prototype('scalar')->end()
->end()
->scalarNode('resource_dir')
->end()
->end()
;
return $treeBuilder;
return new TreeBuilder('wallabag_core');
}
}

View file

@ -9,29 +9,6 @@ class WallabagCoreExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$container->setParameter('wallabag_core.languages', $config['languages']);
$container->setParameter('wallabag_core.items_on_page', $config['items_on_page']);
$container->setParameter('wallabag_core.language', $config['language']);
$container->setParameter('wallabag_core.feed_limit', $config['rss_limit']);
$container->setParameter('wallabag_core.reading_speed', $config['reading_speed']);
$container->setParameter('wallabag_core.version', $config['version']);
$container->setParameter('wallabag_core.paypal_url', $config['paypal_url']);
$container->setParameter('wallabag_core.cache_lifetime', $config['cache_lifetime']);
$container->setParameter('wallabag_core.action_mark_as_read', $config['action_mark_as_read']);
$container->setParameter('wallabag_core.list_mode', $config['list_mode']);
$container->setParameter('wallabag_core.display_thumbnails', $config['display_thumbnails']);
$container->setParameter('wallabag_core.fetching_error_message', $config['fetching_error_message']);
$container->setParameter('wallabag_core.fetching_error_message_title', $config['fetching_error_message_title']);
$container->setParameter('wallabag_core.api_limit_mass_actions', $config['api_limit_mass_actions']);
$container->setParameter('wallabag_core.default_internal_settings', $config['default_internal_settings']);
$container->setParameter('wallabag_core.site_credentials.encryption_key_path', $config['encryption_key_path']);
$container->setParameter('wallabag_core.default_ignore_origin_instance_rules', $config['default_ignore_origin_instance_rules']);
$container->setParameter('wallabag_core.fonts', $config['fonts']);
$container->setParameter('wallabag_core.allow_mimetypes', $config['allow_mimetypes']);
$container->setParameter('wallabag_core.resource_dir', $config['resource_dir']);
}
public function getAlias()