From 77c2a06576b5a2d7d6ec90d8aa7e9f89e88ec91c Mon Sep 17 00:00:00 2001 From: Justin Freeman Date: Tue, 16 Nov 2021 13:16:42 +1100 Subject: [PATCH] CIVICRM-1887 SearchKit with Form Builder, when viewed on the front-end displays a CiviCRM breadcrumb trail which can duplicate the existing website breadcrumb trail. Do not display breadcrumb on front-end pages --- ext/afform/core/CRM/Afform/Page/AfformBase.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/ext/afform/core/CRM/Afform/Page/AfformBase.php b/ext/afform/core/CRM/Afform/Page/AfformBase.php index 5b8bb9e7dd..aceb38f6e8 100644 --- a/ext/afform/core/CRM/Afform/Page/AfformBase.php +++ b/ext/afform/core/CRM/Afform/Page/AfformBase.php @@ -18,8 +18,11 @@ class CRM_Afform_Page_AfformBase extends CRM_Core_Page { Civi::service('angularjs.loader') ->addModules([$afform['module_name'], 'afformStandalone']); - // If the user has "access civicrm" append home breadcrumb - if (CRM_Core_Permission::check('access CiviCRM')) { + $config = \CRM_Core_Config::singleton(); + $isFrontEndPage = $config->userSystem->isFrontEndPage(); + + // 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) { 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')) { @@ -38,7 +41,14 @@ class CRM_Afform_Page_AfformBase extends CRM_Core_Page { if (!empty($afform['title'])) { $title = strip_tags($afform['title']); CRM_Utils_System::setTitle($title); - CRM_Utils_System::appendBreadCrumb([['title' => $title, 'url' => CRM_Utils_System::url(implode('/', $pagePath)) . '#']]); + if (!$isFrontEndPage) { + CRM_Utils_System::appendBreadCrumb([ + [ + 'title' => $title, + 'url' => CRM_Utils_System::url(implode('/', $pagePath)) . '#', + ], + ]); + } } parent::run(); -- 2.25.1