Skip to content
Snippets Groups Projects
Commit d6af41d0 authored by colemanw's avatar colemanw
Browse files

AdminUI - Hide tabs for empty custom groups

Custom groups with no enabled fields should not appear
on the contact summary screen.

This looks to have recently regressed in core as well,
so I'm fixing it in both places.
parent fb5943f2
Branches
Tags
No related merge requests found
......@@ -434,6 +434,10 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View {
$activeGroups = CRM_Core_BAO_CustomGroup::getAll($filters, CRM_Core_Permission::VIEW);
foreach ($activeGroups as $group) {
// Skip if custom group has no enabled fields
if (!count($group['fields'])) {
continue;
}
$id = "custom_{$group['id']}";
$allTabs[] = [
'id' => $id,
......
......@@ -63,6 +63,14 @@ class GetAfforms extends \Civi\Api4\Generic\BasicBatchAction {
->execute()
->column('name');
// Custom group has no enabled fields; nothing to generate.
if (!$item['field_names']) {
return [
'id' => $item['id'],
'forms' => $forms,
];
}
// restrict forms other than block to if Admin UI is enabled
$hasAdminUi = \CRM_Extension_System::singleton()->getMapper()->isActiveModule('civicrm_admin_ui');
if (!$hasAdminUi) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment