Commit 2ce81580 authored by totten's avatar totten

CRM_Core_BAO_ConfigSetting - Support components from extensions

parent 75e91b53
...@@ -347,10 +347,12 @@ class CRM_Core_BAO_ConfigSetting { ...@@ -347,10 +347,12 @@ class CRM_Core_BAO_ConfigSetting {
if (!empty($enableComponents)) { if (!empty($enableComponents)) {
$defaults['enableComponents'] = $enableComponents; $defaults['enableComponents'] = $enableComponents;
$components = CRM_Core_Component::getComponents(); // Lookup component IDs. Note: Do *not* instantiate components.
// Classloading may not be fully setup yet.
$components = CRM_Core_Component::getComponentIDs();
$enabledComponentIDs = array(); $enabledComponentIDs = array();
foreach ($defaults['enableComponents'] as $name) { foreach ($defaults['enableComponents'] as $name) {
$enabledComponentIDs[] = $components[$name]->componentID; $enabledComponentIDs[] = $components[$name];
} }
$defaults['enableComponentIDs'] = $enabledComponentIDs; $defaults['enableComponentIDs'] = $enabledComponentIDs;
} }
......
...@@ -112,6 +112,23 @@ class CRM_Core_Component { ...@@ -112,6 +112,23 @@ class CRM_Core_Component {
return $_cache; return $_cache;
} }
/**
* @return array
* Array(string $name => int $id).
*/
public static function &getComponentIDs() {
$componentIDs = array();
$cr = new CRM_Core_DAO_Component();
$cr->find(FALSE);
while ($cr->fetch()) {
$componentIDs[$cr->name] = $cr->id;
}
return $componentIDs;
}
/** /**
* @param bool $force * @param bool $force
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment