Skip to content

Instantly share code, notes, and snippets.

@joeke
Created February 20, 2016 22:38
Show Gist options
  • Save joeke/783ed9b3b9a99182297a to your computer and use it in GitHub Desktop.
Save joeke/783ed9b3b9a99182297a to your computer and use it in GitHub Desktop.
Modx ExtJS: rearrange resource tabs
```
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