]> source.dussan.org Git - nextcloud-server.git/commitdiff
add core fileclient script before others 39867/head
authorRobin Appelman <robin@icewind.nl>
Thu, 17 Aug 2023 09:18:26 +0000 (11:18 +0200)
committerRobin Appelman <robin@icewind.nl>
Thu, 17 Aug 2023 09:18:26 +0000 (11:18 +0200)
Signed-off-by: Robin Appelman <robin@icewind.nl>
core/Listener/BeforeTemplateRenderedListener.php
lib/public/Util.php

index 95adfc61ad95916ba3227193ed4531ae3d51f91a..0eff47449c7143c53f56c79230eae82600f33b9c 100644 (file)
@@ -62,9 +62,9 @@ class BeforeTemplateRenderedListener implements IEventListener {
                        Util::addTranslations('core');
 
                        if ($event->getResponse()->getRenderAs() !== TemplateResponse::RENDER_AS_ERROR) {
-                               Util::addScript('core', 'files_fileinfo');
-                               Util::addScript('core', 'files_client');
-                               Util::addScript('core', 'merged-template-prepend');
+                               Util::addScript('core', 'merged-template-prepend', 'core', true);
+                               Util::addScript('core', 'files_client', 'core', true);
+                               Util::addScript('core', 'files_fileinfo', 'core', true);
 
 
                                // If installed and background job is set to ajax, add dedicated script
index 1d03c35a9b7a9e797b9bfc00ac150e6c8f288b07..bff8038b3dda521a9d8ca85bc1dd0f47a6f0d710 100644 (file)
@@ -169,9 +169,10 @@ class Util {
         * @param string $application
         * @param string|null $file
         * @param string $afterAppId
+        * @param bool $prepend
         * @since 4.0.0
         */
-       public static function addScript(string $application, string $file = null, string $afterAppId = 'core'): void {
+       public static function addScript(string $application, string $file = null, string $afterAppId = 'core', bool $prepend = false): void {
                if (!empty($application)) {
                        $path = "$application/js/$file";
                } else {
@@ -194,7 +195,11 @@ class Util {
                        self::$scriptDeps[$application]->addDep($afterAppId);
                }
 
-               self::$scripts[$application][] = $path;
+               if ($prepend) {
+                       array_unshift(self::$scripts[$application], $path);
+               } else {
+                       self::$scripts[$application][] = $path;
+               }
        }
 
        /**