diff --git a/Bridge/ElFinderBridge.php b/Bridge/ElFinderBridge.php
index fdc0ff3..33da06b 100644
--- a/Bridge/ElFinderBridge.php
+++ b/Bridge/ElFinderBridge.php
@@ -3,6 +3,7 @@
namespace FM\ElfinderBundle\Bridge;
use FM\ElFinderPHP\ElFinder;
+use FM\ElFinderPHP\Driver\ElFinderVolumeDriver;
/**
* Class ElFinderBridge
@@ -21,7 +22,7 @@ protected function mountVolumes($opts)
$volume = null;
if (isset($o['service'])) {
$driver = $o['service'];
- if (is_object($driver) && $driver instanceof \FM\ElFinderPHP\Driver\ElFinderVolumeDriver) {
+ if (is_object($driver) && $driver instanceof ElFinderVolumeDriver) {
$volume = $driver;
unset($opts['roots'][$i]);
}
diff --git a/Configuration/ElFinderConfigurationReader.php b/Configuration/ElFinderConfigurationReader.php
index 3f90fc3..7b72543 100644
--- a/Configuration/ElFinderConfigurationReader.php
+++ b/Configuration/ElFinderConfigurationReader.php
@@ -3,6 +3,7 @@
namespace FM\ElfinderBundle\Configuration;
use FM\ElfinderBundle\Model\ElFinderConfigurationProviderInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
@@ -27,14 +28,20 @@ class ElFinderConfigurationReader implements ElFinderConfigurationProviderInterf
*/
protected $requestStack;
+ /**
+ * @var ContainerInterface
+ */
+ protected $container;
+
/**
* @param $parameters
* @param \Symfony\Component\HttpFoundation\RequestStack $requestStack
*/
- public function __construct($parameters, RequestStack $requestStack)
+ public function __construct($parameters, RequestStack $requestStack, ContainerInterface $container)
{
$this->parameters = $parameters;
$this->requestStack = $requestStack;
+ $this->container = $container;
}
/**
@@ -53,7 +60,7 @@ public function getConfiguration($instance)
foreach ($parameters['connector']['roots'] as $parameter) {
$path = $parameter['path'];
- $driver = isset($parameter['driver']) ? $parameter['driver'] : null;
+ $driver = $this->container->has($parameter['driver']) ? $this->container->get($parameter['driver']) : null;
$driverOptions = array(
'driver' => $parameter['driver'],
diff --git a/Controller/ElFinderController.php b/Controller/ElFinderController.php
index fb586dc..e41f624 100644
--- a/Controller/ElFinderController.php
+++ b/Controller/ElFinderController.php
@@ -17,7 +17,8 @@ class ElFinderController extends Controller
/**
* Renders Elfinder
- * @param string $instance
+ * @param Request $request
+ * @param string $instance
* @return Response
*/
public function showAction(Request $request, $instance)
@@ -32,6 +33,7 @@ public function showAction(Request $request, $instance)
/**
* @param $parameters
* @param $instance
+ * @param null $formTypeId
* @return array
*/
private function selectEditor($parameters, $instance, $formTypeId = null)
@@ -39,6 +41,7 @@ private function selectEditor($parameters, $instance, $formTypeId = null)
$editor = $parameters['editor'];
$locale = $parameters['locale'] ?: $this->container->getParameter('locale');
$fullscreen = $parameters['fullscreen'];
+ $relativePath = $parameters['relative_path'];
$includeAssets = $parameters['include_assets'];
$compression = $parameters['compression'];
$prefix = ($compression ? '/compressed' : '');
@@ -78,7 +81,8 @@ private function selectEditor($parameters, $instance, $formTypeId = null)
'fullscreen' => $fullscreen,
'includeAssets' => $includeAssets,
'instance' => $instance,
- 'id'=>$formTypeId
+ 'id' => $formTypeId,
+ 'relative_path' => $relativePath
);
return $result;
default:
diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php
index 51df1b5..7d6b813 100644
--- a/DependencyInjection/Configuration.php
+++ b/DependencyInjection/Configuration.php
@@ -39,6 +39,7 @@ public function getConfigTreeBuilder()
->booleanNode('include_assets')->defaultTrue()->end()
->scalarNode('tinymce_popup_path')->defaultValue('')->end()
->booleanNode('enableUserIntegration')->defaultFalse()->end()
+ ->booleanNode('relative_path')->defaultTrue()->end()
->arrayNode('connector')
->addDefaultsIfNotSet()
->children()
@@ -50,10 +51,6 @@ public function getConfigTreeBuilder()
->children()
->scalarNode('driver')
->isRequired()
- ->validate()
- ->ifNotInArray(array('LocalFileSystem', 'FTP', 'FTPIIS', 'Dropbox', 'S3'))
- ->thenInvalid('Invalid filesystem driver "%s"')
- ->end()
->defaultValue('LocalFileSystem')->end()
->arrayNode('disabled')
->prototype('scalar')->end()
@@ -65,7 +62,6 @@ public function getConfigTreeBuilder()
->scalarNode('alias')->defaultValue('')->end()
->integerNode('treeDeep')->defaultValue(0)->end()
->scalarNode('accessControl')->defaultNull()->end()
- ->booleanNode('enableUserIntegration')->defaultFalse()->end()
->arrayNode('upload_allow')
->prototype('scalar')->end()
->defaultValue(array('image'))
diff --git a/Resources/config/elfinder.xml b/Resources/config/elfinder.xml
index f07f9e2..baa0fcb 100644
--- a/Resources/config/elfinder.xml
+++ b/Resources/config/elfinder.xml
@@ -12,6 +12,7 @@
%fm_elfinder%
+
diff --git a/Resources/views/Elfinder/elfinder_type.html.twig b/Resources/views/Elfinder/elfinder_type.html.twig
index 393a234..7ab3880 100644
--- a/Resources/views/Elfinder/elfinder_type.html.twig
+++ b/Resources/views/Elfinder/elfinder_type.html.twig
@@ -15,7 +15,11 @@
url : '{{path('ef_connect', { 'instance': instance } )}}',
lang : '{{locale}}',
getFileCallback: function(file) {
- window.opener.setValue(file.path, "{{ id }}");
+ {% if relative_path %}
+ window.opener.setValue(file.path, "{{ id }}");
+ {% else %}
+ window.opener.setValue(file.url, "{{ id }}");
+ {% endif %}
window.close();
}
});