Skip to content

Commit

Permalink
connector options override
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas MURE committed Mar 19, 2015
1 parent cace52d commit 4c9ecec
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Configuration/ElFinderConfigurationReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down
5 changes: 5 additions & 0 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down

0 comments on commit 4c9ecec

Please sign in to comment.