|
22 | 22 | use Symfony\Component\DependencyInjection; |
23 | 23 | use TYPO3\CMS\Fluid; |
24 | 24 | use TYPO3\CMS\Frontend; |
| 25 | +use TYPO3\CMS\Seo; |
25 | 26 |
|
26 | 27 | return static function ( |
27 | 28 | DependencyInjection\ContainerBuilder $container, |
@@ -52,11 +53,19 @@ static function (DependencyInjection\ChildDefinition $definition, Attribute\AsHe |
52 | 53 | }, |
53 | 54 | ); |
54 | 55 |
|
55 | | - // Make sure the FLUIDTEMPLATE content object always receives an instance of FluidViewFactory, |
56 | | - // because it fails hard if any other view than FluidViewAdapter is resolved, which cannot be |
57 | | - // assured when using our custom HandlebarsViewFactory, as we don't know the exact context. |
58 | | - $configurator->services() |
59 | | - ->get(Frontend\ContentObject\FluidTemplateContentObject::class) |
60 | | - ->arg('$viewFactory', new DependencyInjection\Reference(Fluid\View\FluidViewFactory::class)) |
61 | | - ; |
| 56 | + // Make sure various services always receive an instance of FluidViewFactory, because they fail |
| 57 | + // hard if any other view than FluidViewAdapter is resolved, which cannot be assured when using |
| 58 | + // our custom HandlebarsViewFactory, as we don't know the exact context. |
| 59 | + $services = $configurator->services(); |
| 60 | + $fluidViewFactoryReference = new DependencyInjection\Reference(Fluid\View\FluidViewFactory::class); |
| 61 | + $servicesRequestingFluidViewFactory = [ |
| 62 | + Frontend\ContentObject\FluidTemplateContentObject::class => '$viewFactory', |
| 63 | + Seo\XmlSitemap\XmlSitemapRenderer::class => '$viewFactory', |
| 64 | + ]; |
| 65 | + |
| 66 | + foreach ($servicesRequestingFluidViewFactory as $className => $argumentName) { |
| 67 | + if (class_exists($className)) { |
| 68 | + $services->get($className)->arg($argumentName, $fluidViewFactoryReference); |
| 69 | + } |
| 70 | + } |
62 | 71 | }; |
0 commit comments