From: Coleman Watts Date: Sun, 28 Feb 2021 05:10:39 +0000 (-0500) Subject: Afform - Add link to edit form in breadcrumbs X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=cf77514d8c601ec9214d91eb4fe14d024d516598;p=civicrm-core.git Afform - Add link to edit form in breadcrumbs --- 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();