Skip to content

Commit

Permalink
[Media] Move configuration to Bundle Extension.
Browse files Browse the repository at this point in the history
  • Loading branch information
NoUseFreak committed Apr 1, 2015
1 parent 7455253 commit 93c6811
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 18 deletions.
18 changes: 0 additions & 18 deletions app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,3 @@ stof_doctrine_extensions:
orm:
default:
tree: true

fm_elfinder:
instances:
default:
locale: %locale%
editor: ckeditor
fullscreen: true
theme: smoothness
include_assets: true
connector:
roots:
uploads:
show_hidden: false
driver: clastic.elfinder.driver.filesystem
path: uploads
upload_allow: ['all']
upload_deny: []
upload_max_size: 20M
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public function prepend(ContainerBuilder $container)
if (true === isset($bundles['TwigBundle'])) {
$this->configureTwigBundle($container);
}
if (true === isset($bundles['FMElfinderBundle'])) {
$this->configureFMElfinderBundle($container);
}
}

/**
Expand All @@ -64,4 +67,55 @@ protected function configureTwigBundle(ContainerBuilder $container)
}
}
}

/**
* @param ContainerBuilder $container The service container
*
* @return void
*/
protected function configureFMElfinderBundle(ContainerBuilder $container)
{
foreach (array_keys($container->getExtensions()) as $name) {
switch ($name) {
case 'fm_elfinder':
$container->prependExtensionConfig(
$name,
$this->getElFinderConfiguration()
);
break;
}
}
}

/**
* Default ElFinder configuration
*
* @return array
*/
protected function getElFinderConfiguration()
{
return array(
'instances' => array(
'default' => array(
'locale' => '',
'editor' => 'ckeditor',
'fullscreen' => true,
'theme' => 'smoothness',
'include_assets' => true,
'connector' => array(
'roots' => array(
'uploads' => array(
'show_hidden' => false,
'driver' => 'clastic.elfinder.driver.filesystem',
'path' => 'uploads',
'upload_allow' => array('all'),
'upload_deny' => array(),
'upload_max_size' => '20M',
),
),
),
)
)
);
}
}

0 comments on commit 93c6811

Please sign in to comment.