From 4c9ececf838b58176fe1cf59b0d244405a0385f9 Mon Sep 17 00:00:00 2001 From: Nicolas MURE Date: Thu, 19 Mar 2015 17:20:56 +0100 Subject: [PATCH] connector options override --- Configuration/ElFinderConfigurationReader.php | 10 ++++++++++ DependencyInjection/Configuration.php | 5 +++++ README.md | 4 ++++ 3 files changed, 19 insertions(+) diff --git a/Configuration/ElFinderConfigurationReader.php b/Configuration/ElFinderConfigurationReader.php index 6389e62..17d8873 100644 --- a/Configuration/ElFinderConfigurationReader.php +++ b/Configuration/ElFinderConfigurationReader.php @@ -112,6 +112,16 @@ public function getConfiguration($instance) if($parameter['driver'] == 'Flysystem') { $driverOptions['filesystem'] = $filesystem; } + + if (isset($parameter['options'])) { + foreach($parameter['options'] as $option => $value) { + // we do not override previously defined options from config.yml file + if (!isset($driverOptions[$option])) { + $driverOptions[$option] = $value; + } + } + } + $options['roots'][] = array_merge($driverOptions, $this->configureDriver($parameter)); } diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 1555a33..06ec2aa 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -83,6 +83,11 @@ public function getConfigTreeBuilder() ->defaultValue(array('all')) ->end() ->scalarNode('upload_max_size')->defaultValue('2M')->end() + ->arrayNode('options') + ->normalizeKeys(false) + ->prototype('scalar')->end() + ->defaultValue(array()) + ->end() ->arrayNode('dropbox_settings') ->canBeEnabled() ->children() diff --git a/README.md b/README.md index 23e8f9d..e72e9dd 100644 --- a/README.md +++ b/README.md @@ -161,6 +161,9 @@ fm_elfinder: upload_allow: ['image/png', 'image/jpg', 'image/jpeg'] upload_deny: ['all'] upload_max_size: 2M + options: # used to override connector's default options (optional) + 'tmbSize': 64 + # ... ``` * default - instance of elfinder, can be used to define multiple configurations of ElFinder, allows simultaneous configuration for different types of WYSIWYG editors in your project * path - define root directory for the files inside web/ directory, default is "uploads". Make sure to set proper write/read permissions to this directory. @@ -181,6 +184,7 @@ fm_elfinder: * upload_allow: ['image/png', 'image/jpg', 'image/jpeg'] * upload_deny: ['all'] * upload_max_size: 2M + * options - Used to override connector's default options. Each key is a string corresponding to option name. You can go [here](https://github.com/Studio-42/elFinder/wiki/Connector-configuration-options "connector options list") to see all options list. ### Use multiple upload folder by instance You can set multiple upload root folder by instance configuration.