Created
February 20, 2016 22:38
-
-
Save joeke/783ed9b3b9a99182297a to your computer and use it in GitHub Desktop.
Modx ExtJS: rearrange resource tabs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
switch ($modx->event->name) { | |
case 'OnBeforeManagerPageInit': | |
$modx->controller->addHtml(' | |
<script> | |
Ext.ComponentMgr.onAvailable("modx-resource-tabs", function() { | |
// Order of tabs | |
var tabs = { | |
"modx-panel-resource-tv": null, | |
"modx-page-settings": null, | |
"modx-resource-settings": null, | |
"modx-resource-access-permissions": null, | |
}; | |
var i, item, id; | |
for (i in this.items) { | |
if (this.items.hasOwnProperty(i)) { | |
item = this.items[i]; | |
id = item["id"]; | |
// TV tab has no id for some reason | |
if (id == undefined && item["xtype"] == "modx-panel-resource-tv") { | |
id = "modx-panel-resource-tv"; | |
} | |
tabs[id] = item; | |
} | |
} | |
this.items = []; | |
for (i in tabs) { | |
if (tabs.hasOwnProperty(i)) { | |
this.items.push(tabs[i]); | |
} | |
} | |
}); | |
</script> | |
'); | |
break; | |
} | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment