From cf77514d8c601ec9214d91eb4fe14d024d516598 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Sun, 28 Feb 2021 00:10:39 -0500 Subject: [PATCH] Afform - Add link to edit form in breadcrumbs --- ext/afform/core/CRM/Afform/Page/AfformBase.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/ext/afform/core/CRM/Afform/Page/AfformBase.php b/ext/afform/core/CRM/Afform/Page/AfformBase.php index a2981b63aa..079d58a320 100644 --- a/ext/afform/core/CRM/Afform/Page/AfformBase.php +++ b/ext/afform/core/CRM/Afform/Page/AfformBase.php @@ -30,7 +30,19 @@ 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), NULL, FALSE, '!/')]]); + } + + // If the user has "access civicrm" append home breadcrumb + if (CRM_Core_Permission::check('access CiviCRM')) { + CRM_Utils_System::appendBreadCrumb([['title' => 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') && CRM_Utils_Array::findAll( + \CRM_Extension_System::singleton()->getMapper()->getActiveModuleFiles(), + ['fullName' => 'org.civicrm.afform_admin'] + )) { + CRM_Utils_System::appendBreadCrumb([['title' => E::ts('Form Builder'), 'url' => CRM_Utils_System::url('civicrm/admin/afform')]]); + CRM_Utils_System::appendBreadCrumb([['title' => E::ts('Edit Form'), 'url' => CRM_Utils_System::url('civicrm/admin/afform', NULL, FALSE, '/edit/' . $pageArgs['afform'])]]); + } } parent::run(); -- 2.25.1