getExtensionById('taoQtiItem')->hasConfig('metadata_registry')) { $oldConfig = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem')->getConfig('metadata_registry'); foreach ($oldConfig as $key => $value) { if (is_array($value)) { $importerConfig[$key] = array_unique($value, SORT_STRING); } } } else { $importerConfig = [ MetadataImporter::INJECTOR_KEY => [OntologyLomInjector::class], MetadataImporter::EXTRACTOR_KEY => [GenericLomManifestClassificationExtractor::class], MetadataImporter::GUARDIAN_KEY => [], MetadataImporter::CLASS_LOOKUP_KEY => [], ]; } $options = [ MetadataService::IMPORTER_KEY => new MetadataImporter( $importerConfig ), MetadataService::EXPORTER_KEY => new MetadataExporter([ MetadataExporter::INJECTOR_KEY => [ImsManifestLomInjector::class], MetadataExporter::EXTRACTOR_KEY => [GenericLomOntologyClassificationExtractor::class], ]) ]; $metadataService = $this->getServiceLocator()->build(MetadataService::class, $options); $this->getServiceLocator()->register(MetadataService::SERVICE_ID, $metadataService); if (\common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem')->hasConfig('metadata_registry')) { \common_ext_ExtensionsManager::singleton()->getExtensionById('taoQtiItem')->unsetConfig('metadata_registry'); } return \common_report_Report::createSuccess(__('Metadata service successfully registered.')); } }