CRM_Core_Component_Info had a quasi-listener for adding managed entities; it was only used by CiviCase.
This moves it to a real listener in the civi_case extension.
return $result;
}
- /**
- * @inheritDoc
- * @return array
- * @throws CRM_Core_Exception
- */
- public function getManagedEntities() {
- $entities = array_merge(
- CRM_Case_ManagedEntities::createManagedCaseTypes(),
- CRM_Case_ManagedEntities::createManagedActivityTypes(CRM_Case_XMLRepository::singleton(), CRM_Core_ManagedEntities::singleton()),
- CRM_Case_ManagedEntities::createManagedRelationshipTypes(CRM_Case_XMLRepository::singleton(), CRM_Core_ManagedEntities::singleton())
- );
- return $entities;
- }
-
/**
* @inheritDoc
* @param bool $getAllUnconditionally
*/
abstract public function getInfo();
- /**
- * Get a list of entities to register via API.
- *
- * @return array
- * list of entities; same format as CRM_Utils_Hook::managedEntities(&$entities)
- * @see CRM_Utils_Hook::managedEntities
- */
- public function getManagedEntities() {
- return [];
- }
-
/**
* Provides permissions that are unwise for Anonymous Roles to have.
*
*/
protected function getDeclarations($modules = NULL): array {
$declarations = [];
- // Exclude components if given a module name.
- if (!$modules || $modules === ['civicrm']) {
- foreach (CRM_Core_Component::getEnabledComponents() as $component) {
- $declarations = array_merge($declarations, $component->getManagedEntities());
- }
- }
CRM_Utils_Hook::managed($declarations, $modules);
$this->validate($declarations);
foreach (array_keys($declarations) as $name) {
<?php
require_once 'civi_case.civix.php';
+use CRM_Case_ExtensionUtil as E;
+
+/**
+ * Implements hook_civicrm_managed().
+ */
+function civi_case_civicrm_managed(&$entities, $modules) {
+ // Don't optimize for $modules because the below functions delegate to other extensions
+ $entities = array_merge($entities,
+ CRM_Case_ManagedEntities::createManagedCaseTypes(),
+ CRM_Case_ManagedEntities::createManagedActivityTypes(CRM_Case_XMLRepository::singleton(), CRM_Core_ManagedEntities::singleton()),
+ CRM_Case_ManagedEntities::createManagedRelationshipTypes(CRM_Case_XMLRepository::singleton(), CRM_Core_ManagedEntities::singleton())
+ );
+}