Permalink
Browse files

Merge pull request #10 from LokeyCoding/MP-9

Fixed admin config section ordering bug
  • Loading branch information...
2 parents aeba7e2 + 2c3bffa commit 0574aebe055ed111e288d3687d2251fee403914a @LeeSaferite LeeSaferite committed May 20, 2012
Showing with 18 additions and 4 deletions.
  1. +18 −4 app/code/core/Mage/Adminhtml/Block/System/Config/Tabs.php
@@ -81,12 +81,20 @@ public function initTabs()
$sections = $configFields->getSections($current);
$tabs = (array)$configFields->getTabs()->children();
-
- $sections = (array)$sections;
-
- usort($sections, array($this, '_sort'));
usort($tabs, array($this, '_sort'));
+ $tabSections = array();
+ foreach ((array)$sections as $section) {
+ $tab = (string)$section->tab;
+ if (!empty($tab)) {
+ if (!isset($tabSections[$tab])) {
+ $tabSections[$tab] = array();
+ }
+ $tabSections[$tab][] = $section;
+ }
+ }
+ $sections = array();
+
foreach ($tabs as $tab) {
$helperName = $configFields->getAttributeModule($tab);
$label = Mage::helper($helperName)->__((string)$tab->label);
@@ -95,6 +103,12 @@ public function initTabs()
'label' => $label,
'class' => (string) $tab->class
));
+
+ if (isset($tabSections[$tab->getName()])) {
+ $section = $tabSections[$tab->getName()];
+ usort($section, array($this, '_sort'));
+ $sections = array_merge($sections, $section);
+ }
}

0 comments on commit 0574aeb

Please sign in to comment.