diff --git a/Controller/ElFinderController.php b/Controller/ElFinderController.php index 6419c0d..fb586dc 100644 --- a/Controller/ElFinderController.php +++ b/Controller/ElFinderController.php @@ -3,6 +3,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\Request; /** * Loader service for Elfinder backend @@ -19,11 +20,11 @@ class ElFinderController extends Controller * @param string $instance * @return Response */ - public function showAction($instance) + public function showAction(Request $request, $instance) { $efParameters = $this->container->getParameter('fm_elfinder'); $parameters = $efParameters['instances'][$instance]; - $result = $this->selectEditor($parameters, $instance); + $result = $this->selectEditor($parameters, $instance, $request->get("id")); return $this->render($result['template'], $result['params']); } @@ -33,7 +34,7 @@ public function showAction($instance) * @param $instance * @return array */ - private function selectEditor($parameters, $instance) + private function selectEditor($parameters, $instance, $formTypeId = null) { $editor = $parameters['editor']; $locale = $parameters['locale'] ?: $this->container->getParameter('locale'); @@ -76,7 +77,8 @@ private function selectEditor($parameters, $instance) 'locale' => $locale, 'fullscreen' => $fullscreen, 'includeAssets' => $includeAssets, - 'instance' => $instance + 'instance' => $instance, + 'id'=>$formTypeId ); return $result; default: diff --git a/Resources/views/Elfinder/elfinder_type.html.twig b/Resources/views/Elfinder/elfinder_type.html.twig index af785a5..393a234 100644 --- a/Resources/views/Elfinder/elfinder_type.html.twig +++ b/Resources/views/Elfinder/elfinder_type.html.twig @@ -15,7 +15,7 @@ url : '{{path('ef_connect', { 'instance': instance } )}}', lang : '{{locale}}', getFileCallback: function(file) { - window.opener.setValue(file.path); + window.opener.setValue(file.path, "{{ id }}"); window.close(); } }); diff --git a/Resources/views/Form/elfinder_widget.html.twig b/Resources/views/Form/elfinder_widget.html.twig index dc0c538..b99287d 100644 --- a/Resources/views/Form/elfinder_widget.html.twig +++ b/Resources/views/Form/elfinder_widget.html.twig @@ -2,11 +2,11 @@ {% if enable and instance is defined %} {% endif %}