|
13 | 13 |
|
14 | 14 | namespace Pimcore\Bundle\AdminBundle\DependencyInjection; |
15 | 15 |
|
| 16 | +use Pimcore; |
16 | 17 | use Pimcore\Bundle\CoreBundle\DependencyInjection\ConfigurationHelper; |
| 18 | +use Pimcore\Bundle\SimpleBackendSearchBundle\PimcoreSimpleBackendSearchBundle; |
17 | 19 | use Pimcore\Config\LocationAwareConfigRepository; |
18 | 20 | use Symfony\Component\Config\FileLocator; |
19 | 21 | use Symfony\Component\DependencyInjection\ContainerBuilder; |
20 | 22 | use Symfony\Component\DependencyInjection\Extension\Extension; |
21 | 23 | use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; |
22 | 24 | use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; |
| 25 | +use Symfony\Component\Yaml\Yaml; |
23 | 26 |
|
24 | 27 | /** |
25 | 28 | * @internal |
@@ -48,6 +51,34 @@ public function load(array $configs, ContainerBuilder $container): void |
48 | 51 | $loader->load('event_listeners.yaml'); |
49 | 52 | $loader->load('export.yaml'); |
50 | 53 |
|
| 54 | + // Check if PimcoreSimpleBackendSearchBundle is installed and load to replace the search data provider services |
| 55 | + try { |
| 56 | + $bundle = Pimcore::getKernel()->getBundle('PimcoreSimpleBackendSearchBundle'); |
| 57 | + $configFile = $bundle->getPath() . '/config/admin-classic.yaml'; |
| 58 | + |
| 59 | + $yaml = Yaml::parseFile($configFile); |
| 60 | + |
| 61 | + $tmpFile = tempnam(sys_get_temp_dir(), 'services_'); |
| 62 | + |
| 63 | + try { |
| 64 | + file_put_contents( |
| 65 | + $tmpFile, |
| 66 | + Yaml::dump(['services' => $yaml['services']]) |
| 67 | + ); |
| 68 | + |
| 69 | + $loader = new YamlFileLoader($container, new FileLocator(dirname($tmpFile))); |
| 70 | + |
| 71 | + $loader->load(basename($configFile)); |
| 72 | + } finally { |
| 73 | + if (is_file($tmpFile)) { |
| 74 | + unlink($tmpFile); |
| 75 | + } |
| 76 | + } |
| 77 | + } catch (\Exception $e) { |
| 78 | + // no simple backend search bundle installed |
| 79 | + } |
| 80 | + |
| 81 | + // Merge |
51 | 82 | //Set Config for GDPR data providers to container parameters |
52 | 83 | $container->setParameter('pimcore.gdpr-data-extrator.dataobjects', $config['gdpr_data_extractor']['dataObjects']); |
53 | 84 | $container->setParameter('pimcore.gdpr-data-extrator.assets', $config['gdpr_data_extractor']['assets']); |
|
0 commit comments