*/
protected function getBespokeTokens(): array {
$tokens = [];
- if (array_key_exists('CiviCase', CRM_Core_Component::getEnabledComponents())) {
+ if (CRM_Core_Component::isEnabled('CiviCase')) {
$tokens['case_id'] = ts('Activity Case ID');
return [
'case_id' => [
//don't build membership block when pledge_id is passed
if (empty($this->_values['pledge_id']) && empty($this->_ccid)) {
$this->_separateMembershipPayment = FALSE;
- if (in_array('CiviMember', $config->enableComponents)) {
+ if (CRM_Core_Component::isEnabled('CiviMember')) {
$isTest = 0;
if ($this->_action & CRM_Core_Action::PREVIEW) {
$isTest = 1;
// Preload libraries required by the "Profiles" tab
$schemas = ['IndividualModel', 'OrganizationModel', 'ContributionModel'];
- if (in_array('CiviMember', CRM_Core_Config::singleton()->enableComponents)) {
+ if (CRM_Core_Component::isEnabled('CiviMember')) {
$schemas[] = 'MembershipModel';
}
CRM_UF_Page_ProfileEditor::registerProfileScripts();
return $components;
}
+ /**
+ * Is the specified component enabled.
+ *
+ * @param string $component
+ * Component name - ie CiviMember, CiviContribute, CiviEvent...
+ *
+ * @return bool
+ * Is the component enabled.
+ */
+ public static function isEnabled(string $component): bool {
+ return in_array($component, CRM_Core_Config::singleton()->enableComponents, TRUE);
+ }
+
}