[BUGFIX] Ensure jQuery is loaded as well when loading the Lang module 81/41981/3
authorMarkus Klein <markus.klein@typo3.org>
Mon, 27 Jul 2015 14:29:21 +0000 (16:29 +0200)
committerBenjamin Mack <benni@typo3.org>
Wed, 29 Jul 2015 14:56:12 +0000 (16:56 +0200)
If we forcefully load the JS Lang-module, which depends on jQuery, we
have to ensure that jQuery is requested as well, otherwise the dependency
of the Lang-module fails.

Note that jQuery is never loaded via requireJS. jQuery must be explicitly added
by calling  the loadJquery method of PageRenderer. jQuery itself registers as
an AMD module and can then be used as dependency by other AMD modules.

We therefore also remove the (completely useless) path definition in the
requireJS configuration.

Releases: master
Resolves: #68555
Change-Id: If8ef5b1b79523cf00451f3ba34a00b983945c000
Reviewed-on: http://review.typo3.org/41981
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Tomas Norre Mikkelsen <tomasnorre@gmail.com>
Reviewed-by: Frank Nägler <frank.naegler@typo3.org>
Tested-by: Frank Nägler <frank.naegler@typo3.org>
Reviewed-by: Benjamin Mack <benni@typo3.org>
Tested-by: Benjamin Mack <benni@typo3.org>
typo3/sysext/core/Classes/Page/PageRenderer.php
typo3/sysext/recordlist/Classes/Browser/ElementBrowser.php

index bbfd71f..fd67292 100644 (file)
@@ -1486,7 +1486,6 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface {
                        // first, load all paths for the namespaces, and configure contrib libs.
                        $this->requireJsConfig['paths'] = array(
                                'jquery-ui' => $this->backPath . 'sysext/core/Resources/Public/JavaScript/Contrib/jquery-ui',
-                               'jquery' => $this->backPath . rtrim($this->jQueryPath, '/'),
                                'datatables' => $this->backPath . 'sysext/core/Resources/Public/JavaScript/Contrib/jquery.dataTables',
                                'nprogress' => $this->backPath . 'sysext/core/Resources/Public/JavaScript/Contrib/nprogress',
                                'moment' => $this->backPath . 'sysext/core/Resources/Public/JavaScript/Contrib/moment',
@@ -2029,7 +2028,8 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface {
                                // make sure the global TYPO3 is available
                                $inlineSettings = 'var TYPO3 = TYPO3 || {};' . CRLF . $inlineSettings;
                                $out .= $this->inlineJavascriptWrap[0] . $inlineSettings . $this->inlineJavascriptWrap[1];
-                               if (TYPO3_MODE === 'BE') {
+                               // Add language module only if also jquery is guaranteed to be there
+                               if (TYPO3_MODE === 'BE' && !empty($this->jQueryVersions)) {
                                        $this->loadRequireJsModule('TYPO3/CMS/Lang/Lang');
                                }
                        }
index ce1a1e9..ee7d52b 100755 (executable)
@@ -369,8 +369,10 @@ class ElementBrowser {
                $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
                $this->doc->bodyTagId = 'typo3-browse-links-php';
                $this->doc->backPath = $GLOBALS['BACK_PATH'];
-               $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/BrowseLinks');
-               $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/LegacyTree');
+               $pageRenderer = $this->getPageRenderer();
+               $pageRenderer->loadJquery();
+               $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/BrowseLinks');
+               $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/LegacyTree');
        }
 
        /**