From cfe2b29efd5d9f76d6506b7f364cbf73d6d49626 Mon Sep 17 00:00:00 2001 From: Justin Freeman Date: Tue, 16 Nov 2021 13:16:42 +1100 Subject: [PATCH] CIVICRM-1887 SearchKit, 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 5b8bb9e7ddd4..aceb38f6e85c 100644 --- a/ext/afform/core/CRM/Afform/Page/AfformBase.php +++ b/ext/afform/core/CRM/Afform/Page/AfformBase.php @@ -18,8 +18,11 @@ public function run() { 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 @@ public function run() { 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();