diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php index d194f861..774b9dcc 100644 --- a/code/controllers/CMSMain.php +++ b/code/controllers/CMSMain.php @@ -638,6 +638,18 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr $actions = $record->getAllCMSActions(); } else { $actions = $record->getCMSActions(); + + // Find and remove action menus that have no actions. + if ($actions && $actions->Count()) { + $tabset = $actions->fieldByName('ActionMenus'); + if ($tabset) { + foreach ($tabset->getChildren() as $tab) { + if (!$tab->getChildren()->count()) { + $tabset->removeByName($tab->getName()); + } + } + } + } } // Use