Skip to content

Commit

Permalink
CIVICRM-1887 SearchKit, when viewed on the front-end displays a CiviC…
Browse files Browse the repository at this point in the history
…RM breadcrumb trail which can duplicate the existing website breadcrumb trail. Do not display breadcrumb on front-end pages
  • Loading branch information
agileware-justin committed Nov 16, 2021
1 parent 48dbcda commit cfe2b29
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions ext/afform/core/CRM/Afform/Page/AfformBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')) {
Expand All @@ -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();
Expand Down

0 comments on commit cfe2b29

Please sign in to comment.