From 80ed4e053a54af11c98b6ba71eb579400ebb5f90 Mon Sep 17 00:00:00 2001 From: benjamin Date: Wed, 20 Nov 2024 19:13:51 +0000 Subject: [PATCH] restrict CustomGroup.GetAfforms to block unless civicrm_admin_ui is enabled --- ext/afform/core/Civi/Api4/Action/CustomGroup/GetAfforms.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ext/afform/core/Civi/Api4/Action/CustomGroup/GetAfforms.php b/ext/afform/core/Civi/Api4/Action/CustomGroup/GetAfforms.php index a6e4bffcb0f..51eb7f09607 100644 --- a/ext/afform/core/Civi/Api4/Action/CustomGroup/GetAfforms.php +++ b/ext/afform/core/Civi/Api4/Action/CustomGroup/GetAfforms.php @@ -58,7 +58,11 @@ protected function doTask($item) { ->execute() ->column('name'); - // we also needs this for + // restrict forms other than block to if Admin UI is enabled + $hasAdminUi = \CRM_Extension_System::singleton()->getMapper()->isActiveModule('civicrm_admin_ui'); + if (!$hasAdminUi) { + $this->formTypes = array_intersect(['block'], $this->formTypes); + } foreach ($this->formTypes as $type) { switch ($type) {