Skip to content

Commit

Permalink
Merge pull request #10 from LokeyCoding/MP-9
Browse files Browse the repository at this point in the history
Fixed admin config section ordering bug
  • Loading branch information
LeeSaferite committed May 20, 2012
2 parents aeba7e2 + 2c3bffa commit 0574aeb
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions app/code/core/Mage/Adminhtml/Block/System/Config/Tabs.php
Expand Up @@ -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);
Expand All @@ -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);
}
}


Expand Down

0 comments on commit 0574aeb

Please sign in to comment.