From 0f37942714ff9e8dbed81ca3795283258c44a73b Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Wed, 27 Jul 2011 13:28:49 +0200 Subject: [PATCH] implement core feature #28502: t3lib_extMgm::addModule(): support sorting of main modules --- class.t3lib_extmgm.php | 27 +++++++++++++++++++++++++-- 1 files changed, 25 insertions(+), 2 deletions(-) diff --git a/class.t3lib_extmgm.php b/class.t3lib_extmgm.php index fce9ae8..0cadcee 100644 --- a/class.t3lib_extmgm.php +++ b/class.t3lib_extmgm.php @@ -666,7 +666,30 @@ final class t3lib_extMgm { // Re-inserting the submodule list: $TBE_MODULES[$main] = implode(',', $mods); } else { // Create new main modules with only one submodule, $sub (or none if $sub is blank) - $TBE_MODULES[$main] = $sub; + list($place, $modRef) = t3lib_div::trimExplode(':', $position, 1); + switch(strtolower($place)) { + case 'after': + case 'before': + $keys = array_keys($TBE_MODULES); + $pos = array_search($modRef, $keys); + if ($pos === false) { + $pos = count($TBE_MODULES); + } else if (strtolower($place) == 'after') { + $pos += 1; + } + $TBE_MODULES = array_slice($TBE_MODULES, 0, $pos) + + array($main => $sub) + + array_slice($TBE_MODULES, $pos); + break; + + case 'top': + $TBE_MODULES = array($main => $sub) + $TBE_MODULES; + break; + case 'bottom': + default: + $TBE_MODULES[$main] = $sub; + break; + } } // Adding path: @@ -1489,7 +1512,7 @@ $TYPO3_LOADED_EXT = unserialize(stripslashes(\''.addslashes(serialize($extension // Caching of extensions is disabled when install tool is used: if (!$usePlainValue && defined('TYPO3_enterInstallScript') && TYPO3_enterInstallScript) { $extensionCacheBehaviour = 0; - } + } return $extensionCacheBehaviour; } -- 1.7.4.1