Minimise subpanels with zero records

Hello, I’ve searched around a bit but I can’t find a way to “hide” (minimise) a subpanel when there’s no records in it.

Essentially they take up too much vertical space.

I’ve set the following in config_override.php:

$sugar_config[‘hide_subpanels’] = true;
$sugar_config[‘hide_subpanels_on_login’] = true;

And in user Profiles we can set “Show collapsed subpanel hint” (although has to be done per user?)

This is close to what we want, but not perfect.

I also feel like this code is close to what’s needed but not quite right: Remove Subpanel From DetailView If It Doesn't Have Records

Perfect would be if only the subpanels with records in were maximised…

For Hiding the Subpanel if it’s not having Records then need to do some customization as suggested below.

We have considered Accounts as Primary Module and Contacts as Subpanel.

Create the Logic Hook:

File Path: custom/Extension/application/Ext/LogicHooks/ModuleDetailview_Hook.php

File Path: custom/include/HideSubpanel/HideSubpanel.php

File Path: custom/include/HideSubpanel/js/HideSubpanel.js

Create Custom EntryPoint:

File Path: custom/Extension/application/Ext/EntryPointRegistry/HideSubpanelEntryPoint.php

File Path: custom/GetHideSubpanelNameList.php