From 8ad5ec8983f209d6a2795743b610c4aa53b3c774 Mon Sep 17 00:00:00 2001 From: Rodrigo Santellan Date: Sat, 28 Jan 2023 07:26:32 -0300 Subject: [PATCH] Remove framework assets version to be able to work with RequireJs. (#489) --- src/Controller/ElFinderController.php | 7 ++++++- src/Resources/views/Elfinder/helper/main.js.twig | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Controller/ElFinderController.php b/src/Controller/ElFinderController.php index 60ca0dc..edf67b6 100644 --- a/src/Controller/ElFinderController.php +++ b/src/Controller/ElFinderController.php @@ -7,6 +7,8 @@ use Exception; use FM\ElfinderBundle\Loader\ElFinderLoader; use FM\ElfinderBundle\Session\ElFinderSession; +use Symfony\Component\Asset\Package; +use Symfony\Component\Asset\VersionStrategy\EmptyVersionStrategy; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\JsonResponse; @@ -222,8 +224,11 @@ public function load(SessionInterface $session, HttpKernelInterface $httpKernel, public function mainJS() { + $version = new EmptyVersionStrategy(); + $package = new Package($version); + $mainUrl = $package->getUrl('bundles/fmelfinder/js'); return new Response( - $this->twig->render('@FMElfinder/Elfinder/helper/main.js.twig'), + $this->twig->render('@FMElfinder/Elfinder/helper/main.js.twig',['mainUrl' => $mainUrl]), 200, [ 'Content-type' => 'text/javascript', diff --git a/src/Resources/views/Elfinder/helper/main.js.twig b/src/Resources/views/Elfinder/helper/main.js.twig index 986052b..018b8dc 100644 --- a/src/Resources/views/Elfinder/helper/main.js.twig +++ b/src/Resources/views/Elfinder/helper/main.js.twig @@ -115,7 +115,7 @@ // config of RequireJS (REQUIRED) require.config({ - baseUrl : "{{ asset('bundles/fmelfinder/js') }}", + baseUrl : "{{ mainUrl }}", paths : { 'jquery' : '//cdnjs.cloudflare.com/ajax/libs/jquery/'+(old? '1.12.4' : jqver)+'/jquery.min', 'jquery-ui': '//cdnjs.cloudflare.com/ajax/libs/jqueryui/'+uiver+'/jquery-ui.min',