Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SearchKit with Form Builder when viewed on the front-end displays a CiviCRM breadcrumb trail which can duplicate the existing website breadcrumb trail #22087

Merged
merged 1 commit into from
Nov 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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