public static function &getComponents($force = FALSE) { static $_cache = NULL; if (!$_cache || $force) { $_cache = array(); $cr = new CRM_Core_DAO_Component(); $cr->find(FALSE); while ($cr->fetch()) { $infoClass = $cr->namespace . '_' . self::COMPONENT_INFO_CLASS; require_once str_replace('_', DIRECTORY_SEPARATOR, $infoClass) . '.php'; $infoObject = new $infoClass($cr->name, $cr->namespace, $cr->id); if ($infoObject->info['name'] !== $cr->name) { CRM_Core_Error::fatal("There is a discrepancy between name in component registry and in info file ({$cr->name})."); } $_cache[$cr->name] = $infoObject; unset($infoObject); } } 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; }