Changing Submenu Order that is upgrade safe


Back to this fun challenge of hiding submenus within Accounts.

I have been reading through this thread below…

This has helped me to hide the modules that I don’t want to see.

BUT, the ones that I have left I now want to change the order of them and of course leave them upgrade safe.

I was wondering if I could just go into modules/Accounts/metadata/subpaneldefs.php as in there they seem to have a number, and I’m assuming if I change the number order so the one I want at the top is 10 the next is 20 etc… or using whatever numbers they are, but just changing them around so it’s in the order I want. But that wouldn’t be upgrade safe.

I did wonder if as per the above method for hiding the subpanels. I could just hide all the subpanels, and then instead of unset use set or whatever the appropriate command is to show again the ones I want and then they will just appear in the order I set them to?

What is the best way to change the order of the remaining subpanels to ensure they are upgrade safe?

I’d be grateful for any ideas.

Hi there,

What I would do is for it to be upgrade safe and Repair & Rebuild safe is create a custom extension for your module.

I created a file called ‘reorder_subpanels.php’ and I placed it within custom/Extension/modules/Accounts/Ext/Layoutdefs/

The file reorder_subpanels.php had the following code:


$layout_defs['Accounts']['subpanel_setup']['history']['order'] = 1;
$layout_defs['Accounts']['subpanel_setup']['leads']['order'] = 2;
$layout_defs['Accounts']['subpanel_setup']['opportunities']['order'] = 3;
$layout_defs['Accounts']['subpanel_setup']['accounts']['order'] = 5;

I then did a Repair & Rebuild and checked my custom/modules/Accounts/Ext/Layoutdefs/layoutdefs.php file.
Within that file (as it’s auto-generated) should then contain the contents of my reorder_subpanels file.

Navigate to your Account’s DetailView and that should be your default subpanels reordered.

Hope this helps.


Thank you. :slight_smile: