*
* @return array
* The fields that belong to this ufgroup(s)
- * @throws \Exception
+ *
+ * @throws \CRM_Core_Exception
*/
public static function getFields(
$id,
}
if (empty($fields) && !$validGroup) {
- CRM_Core_Error::fatal(ts('The requested Profile (gid=%1) is disabled OR it is not configured to be used for \'Profile\' listings in its Settings OR there is no Profile with that ID OR you do not have permission to access this profile. Please contact the site administrator if you need assistance.',
+ throw new CRM_Core_Exception(ts('The requested Profile (gid=%1) is disabled OR it is not configured to be used for \'Profile\' listings in its Settings OR there is no Profile with that ID OR you do not have permission to access this profile. Please contact the site administrator if you need assistance.',
[1 => implode(',', $profileIds)]
));
}
);
}
elseif ($fieldName === 'contribution_status_id') {
- $contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus();
+ $contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'label');
$statusName = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
foreach (['In Progress', 'Overdue', 'Refunded'] as $suppress) {
unset($contributionStatuses[CRM_Utils_Array::key($suppress, $statusName)]);
}
}
+ /**
+ * Get the frontend_title for the profile, falling back on 'title' if none.
+ *
+ * @param int $profileID
+ *
+ * @return string
+ *
+ * @throws \CiviCRM_API3_Exception
+ */
+ public static function getFrontEndTitle(int $profileID) {
+ $profile = civicrm_api3('UFGroup', 'getsingle', ['id' => $profileID, 'return' => ['title', 'frontend_title']]);
+ return $profile['frontend_title'] ?? $profile['title'];
+ }
+
}