return CRM_Core_BAO_Note::getContactNoteCount($contactId);
case 'contribution':
- if (array_key_exists('CiviContribute', CRM_Core_Component::getEnabledComponents())) {
+ if (CRM_Core_Component::isEnabled('CiviContribute')) {
return CRM_Contribute_BAO_Contribution::contributionCount($contactId);
}
return FALSE;
case 'membership':
- if (array_key_exists('CiviMember', CRM_Core_Component::getEnabledComponents())) {
+ if (CRM_Core_Component::isEnabled('CiviMember')) {
return CRM_Member_BAO_Membership::getContactMembershipCount((int) $contactId, TRUE);
}
return FALSE;
// @todo - the component is enabled check should be done within getIncomeFinancialType
// It looks to me like test cover was NOT added to cover the change
// that added this so we need to assume there is no test cover
- if (array_key_exists('CiviContribute', CRM_Core_Component::getEnabledComponents())) {
+ if (CRM_Core_Component::isEnabled('CiviContribute')) {
// if check_permission has been passed in (not Null) then restrict.
return CRM_Financial_BAO_FinancialType::getIncomeFinancialType($props['check_permissions'] ?? TRUE);
}
'filters' => [],
'links' => [],
];
- $enabledComponents = Civi::settings()->get('enable_components');
foreach (CRM_Core_DAO_AllCoreTables::daoToClass() as $entity => $daoName) {
// Skip DAOs of disabled components
- if (defined("$daoName::COMPONENT") && !in_array($daoName::COMPONENT, $enabledComponents, TRUE)) {
+ if (defined("$daoName::COMPONENT") && !CRM_Core_Component::isEnabled($daoName::COMPONENT)) {
continue;
}
$baoName = str_replace('_DAO_', '_BAO_', $daoName);
// @todo - the component is enabled check should be done within getIncomeFinancialType
// It looks to me like test cover was NOT added to cover the change
// that added this so we need to assume there is no test cover
- if (array_key_exists('CiviContribute', CRM_Core_Component::getEnabledComponents())) {
+ if (CRM_Core_Component::isEnabled('CiviContribute')) {
return CRM_Financial_BAO_FinancialType::getIncomeFinancialType($props['check_permissions'] ?? TRUE);
}
return [];
* @param null $currentVer
*/
public function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL): void {
- if ($rev === '5.43.alpha1' && !empty(CRM_Core_Component::getEnabledComponents()['CiviCase'])) {
+ if ($rev === '5.43.alpha1' && CRM_Core_Component::isEnabled('CiviCase')) {
$preUpgradeMessage .= '<p>' . ts('Minor changes have been made to how the tokens to render case.is_deleted, case.created_date and case.modified_date. See https://docs.civicrm.org/sysadmin/en/latest/upgrade/version-specific/ for more') . '</p>';
}
}
}
// Check enabled components
$daoName = \CRM_Core_DAO_AllCoreTables::getFullName($entity);
- if ($daoName && defined("{$daoName}::COMPONENT") && !array_key_exists($daoName::COMPONENT, \CRM_Core_Component::getEnabledComponents())) {
+ if ($daoName && defined("{$daoName}::COMPONENT") && !\CRM_Core_Component::isEnabled($daoName::COMPONENT)) {
throw new \Civi\API\Exception\NotImplementedException("$entity API is not available because " . $daoName::COMPONENT . " component is disabled");
}
$apiRequest = call_user_func_array($callable, $e->args);
$info = $className::getInfo();
$daoName = $info['dao'] ?? NULL;
// Only include DAO entities from enabled components
- if (!$daoName || !defined("{$daoName}::COMPONENT") || array_key_exists($daoName::COMPONENT, \CRM_Core_Component::getEnabledComponents())) {
+ if (!$daoName || !defined("{$daoName}::COMPONENT") || \CRM_Core_Component::isEnabled($daoName::COMPONENT)) {
$entities[$info['name']] = $info;
}
}