From 4173971e2cb5b3a4c1aba8d8d3ca8187b2696144 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 19 Jul 2022 11:38:27 -0400 Subject: [PATCH] Afform - Check is_public directly Fixes dev/core#3741 Instead of relying on the menu system to tell if a form is frontend, just read that info directly from the afform definition. --- ext/afform/core/CRM/Afform/Page/AfformBase.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ext/afform/core/CRM/Afform/Page/AfformBase.php b/ext/afform/core/CRM/Afform/Page/AfformBase.php index 715913f5d8..b0517a3aca 100644 --- a/ext/afform/core/CRM/Afform/Page/AfformBase.php +++ b/ext/afform/core/CRM/Afform/Page/AfformBase.php @@ -10,7 +10,7 @@ class CRM_Afform_Page_AfformBase extends CRM_Core_Page { // The api will throw an exception if afform is not found (because of the index 0 param) $afform = civicrm_api4('Afform', 'get', [ 'where' => [['name', '=', $pageArgs['afform']]], - 'select' => ['title', 'module_name', 'directive_name', 'type'], + 'select' => ['title', 'module_name', 'directive_name', 'type', 'is_public'], ], 0); $this->assign('directive', $afform['directive_name']); @@ -18,11 +18,10 @@ class CRM_Afform_Page_AfformBase extends CRM_Core_Page { Civi::service('angularjs.loader') ->addModules([$afform['module_name'], 'afformStandalone']); - $config = \CRM_Core_Config::singleton(); - $isFrontEndPage = $config->userSystem->isFrontEndPage(); + $isFrontEndPage = !empty($afform['is_public']); - // If the user has "access civicrm" append home breadcrumb, if not being shown on the front-end website - if (CRM_Core_Permission::check('access CiviCRM') && !$isFrontEndPage) { + // If not being shown on the front-end website, append breadcrumb for CiviCRM users + if (!$isFrontEndPage && CRM_Core_Permission::check('access CiviCRM')) { CRM_Utils_System::appendBreadCrumb([['title' => E::ts('CiviCRM'), 'url' => CRM_Utils_System::url('civicrm')]]); // If the user has "admin civicrm" & the admin extension is enabled if (CRM_Core_Permission::check('administer CiviCRM')) { -- 2.25.1