$enableComponents = Civi::settings()->get('enable_components');
if (!empty($enableComponents)) {
$defaults['enableComponents'] = $enableComponents;
-
- // Lookup component IDs. Note: Do *not* instantiate components.
- // Classloading may not be fully setup yet.
- $components = CRM_Core_Component::getComponentIDs();
- $enabledComponentIDs = array();
- foreach ($defaults['enableComponents'] as $name) {
- $enabledComponentIDs[] = $components[$name];
- }
- $defaults['enableComponentIDs'] = $enabledComponentIDs;
}
}
}
*/
public static function setEnabledComponents($enabledComponents) {
$config = CRM_Core_Config::singleton();
- $components = CRM_Core_Component::getComponents();
-
- $enabledComponentIDs = array();
- foreach ($enabledComponents as $name) {
- $enabledComponentIDs[] = $components[$name]->componentID;
- }
// fix the config object
$config->enableComponents = $enabledComponents;
- $config->enableComponentIDs = $enabledComponentIDs;
// also force reset of component array
CRM_Core_Component::getEnabledComponents(TRUE);
'CiviMail',
'CiviReport',
);
- public $enableComponentIDs = array(1, 6, 2, 3, 4, 8);
/**
* Should payments be accepted only via SSL?
}
// if component_id is present, ensure it is enabled
- if (isset($item['component_id']) &&
- $item['component_id']
- ) {
+ if (isset($item['component_id']) && $item['component_id']) {
+ if (!isset(Civi::$statics[__CLASS__]['componentNameId'])) {
+ Civi::$statics[__CLASS__]['componentNameId'] = array_flip(CRM_Core_Component::getComponentIDs());
+ }
+ $componentName = Civi::$statics[__CLASS__]['componentNameId'][$item['component_id']];
+
$config = CRM_Core_Config::singleton();
- if (is_array($config->enableComponentIDs) &&
- in_array($item['component_id'], $config->enableComponentIDs)
- ) {
+ if (is_array($config->enableComponents) && in_array($componentName, $config->enableComponents)) {
// continue with process
}
else {