[BUGFIX] Implement EXT: usage in addModule 67/41667/5
authorWouter Wolters <typo3@wouterwolters.nl>
Sat, 18 Jul 2015 12:30:42 +0000 (14:30 +0200)
committerBenjamin Mack <benni@typo3.org>
Sun, 19 Jul 2015 07:42:18 +0000 (09:42 +0200)
Make it possible to use EXT: for resolving paths in addModule

Resolves: #68341
Releases: master, 6.2
Change-Id: Ic26d410f09303baa4fa18c744b30ee72ada09227
Reviewed-on: http://review.typo3.org/41667
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Benjamin Mack <benni@typo3.org>
Tested-by: Benjamin Mack <benni@typo3.org>
typo3/sysext/backend/Classes/Module/ModuleLoader.php
typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php

index 268944e..454f259 100644 (file)
@@ -270,12 +270,18 @@ class ModuleLoader {
                                $altIconAbsPath = is_array($GLOBALS['TBE_STYLES']['skinImg'][$altIconKey]) ? GeneralUtility::resolveBackPath(PATH_typo3 . $GLOBALS['TBE_STYLES']['skinImg'][$altIconKey][0]) : '';
                                // Setting icon, either default or alternative:
                                if ($altIconAbsPath && @is_file($altIconAbsPath)) {
-                                       $defaultLabels['tabs_images']['tab'] = $this->getRelativePath(PATH_typo3, $altIconAbsPath);
+                                       $defaultLabels['tabs_images']['tab'] = $altIconAbsPath;
                                } else {
-                                       // Setting default icon:
-                                       $defaultLabels['tabs_images']['tab'] = $this->getRelativePath(PATH_typo3, $fullPath . '/' . $defaultLabels['tabs_images']['tab']);
+                                       if (\TYPO3\CMS\Core\Utility\StringUtility::beginsWith($defaultLabels['tabs_images']['tab'], 'EXT:')) {
+                                               list($extensionKey, $relativePath) = explode('/', substr($defaultLabels['tabs_images']['tab'], 4), 2);
+                                               $defaultLabels['tabs_images']['tab'] = ExtensionManagementUtility::extPath($extensionKey) . $relativePath;
+                                       } else {
+                                               $defaultLabels['tabs_images']['tab'] = $fullPath . '/' . $defaultLabels['tabs_images']['tab'];
+                                       }
                                }
 
+                               $defaultLabels['tabs_images']['tab'] = $this->getRelativePath(PATH_typo3, $defaultLabels['tabs_images']['tab']);
+
                                // Finally, setting the icon with correct path:
                                if (substr($defaultLabels['tabs_images']['tab'], 0, 3) === '../') {
                                        $defaultLabels['tabs_images']['tab'] = PATH_site . substr($defaultLabels['tabs_images']['tab'], 3);
index 1e60026..d4068c8 100644 (file)
@@ -915,6 +915,11 @@ class ExtensionManagementUtility {
                $fullModuleSignature = $main . ($sub ? '_' . $sub : '');
                // Adding path:
                if ($path) {
+                       if (\TYPO3\CMS\Core\Utility\StringUtility::beginsWith($path, 'EXT:')) {
+                               list($extensionKey, $relativePath) = explode('/', substr($path, 4), 2);
+                               $path = ExtensionManagementUtility::extPath($extensionKey) . $relativePath;
+                       }
+
                        $GLOBALS['TBE_MODULES']['_PATHS'][$fullModuleSignature] = $path;
                }