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();