addListener('hook_civicrm_entityTypes', function ($e) use ($mixInfo) { // When deactivating on a polyfill/pre-mixin system, listeners may not cleanup automatically. if (!$mixInfo->isActive() || !is_dir($mixInfo->getPath('schema'))) { return; } $files = (array) glob($mixInfo->getPath('schema/*.entityType.php')); foreach ($files as $file) { $entity = include $file; $entity['module'] = $mixInfo->longName; $e->entityTypes[$entity['name']] = $entity; } }); };