|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +namespace Netgen\Bundle\BetterIbexaAdminUIBundle\DependencyInjection\Compiler; |
| 6 | + |
| 7 | +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; |
| 8 | +use Symfony\Component\DependencyInjection\ContainerBuilder; |
| 9 | +use Ibexa\AdminUi\Tab\Dashboard\MyContentTab; |
| 10 | +use Ibexa\AdminUi\Tab\Dashboard\EveryoneContentTab; |
| 11 | +use Ibexa\AdminUi\Tab\Dashboard\MyMediaTab; |
| 12 | +use Ibexa\AdminUi\Tab\Dashboard\EveryoneMediaTab; |
| 13 | +use Ibexa\AdminUi\Tab\LocationView\LocationsTab; |
| 14 | +use Ibexa\AdminUi\UI\Service\PathService; |
| 15 | +use Ibexa\GraphQL\DataLoader\SearchContentLoader; |
| 16 | +use Ibexa\GraphQL\DataLoader\SearchLocationLoader; |
| 17 | +use Ibexa\AdminUi\UI\Module\ContentTree\NodeFactory; |
| 18 | +use Ibexa\Bundle\AdminUi\Controller\SectionController; |
| 19 | +use Ibexa\AdminUi\UniversalDiscovery\UniversalDiscoveryProvider; |
| 20 | +use Symfony\Component\DependencyInjection\Reference; |
| 21 | + |
| 22 | +final class SearchOverridePass implements CompilerPassInterface |
| 23 | +{ |
| 24 | + public function process(ContainerBuilder $container): void |
| 25 | + { |
| 26 | + if (!$container->hasDefinition('netgen.ibexa_site_api.filter_service.search_adapter')) { |
| 27 | + return; |
| 28 | + } |
| 29 | + |
| 30 | + $serviceIds = [ |
| 31 | + PathService::class, |
| 32 | + MyContentTab::class, |
| 33 | + EveryoneContentTab::class, |
| 34 | + MyMediaTab::class, |
| 35 | + EveryoneMediaTab::class, |
| 36 | + LocationsTab::class, |
| 37 | + SearchContentLoader::class, |
| 38 | + SearchLocationLoader::class, |
| 39 | + NodeFactory::class, |
| 40 | + SectionController::class, |
| 41 | + UniversalDiscoveryProvider::class, |
| 42 | + ]; |
| 43 | + |
| 44 | + foreach ($serviceIds as $serviceId) { |
| 45 | + $container->findDefinition($serviceId)->setArgument( |
| 46 | + '$searchService', |
| 47 | + new Reference('netgen.ibexa_site_api.filter_service.search_adapter'), |
| 48 | + ); |
| 49 | + } |
| 50 | + } |
| 51 | +} |
0 commit comments