Skip to content

Commit ab41b8c

Browse files
authored
EZP-32067: Injected tagged View Builders into View Builder registry (#127)
1 parent 4698499 commit ab41b8c

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

eZ/Bundle/EzPublishCoreBundle/Resources/config/templating.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,8 @@ services:
220220

221221
ezpublish.view_builder.registry:
222222
class: eZ\Publish\Core\MVC\Symfony\View\Builder\Registry\ControllerMatch
223-
calls:
224-
- [addToRegistry, [["@ezpublish.view_builder.content"]]]
223+
arguments:
224+
$viewBuilders: !tagged_iterator { tag: ibexa.view_builder }
225225

226226
ezpublish.view_builder.content:
227227
class: eZ\Publish\Core\MVC\Symfony\View\Builder\ContentViewBuilder
@@ -231,6 +231,8 @@ services:
231231
- "@ezpublish.view.view_parameters.injector.dispatcher"
232232
- "@request_stack"
233233
- "@ezpublish.content_info_location_loader.main"
234+
tags:
235+
- { name: ibexa.view_builder }
234236

235237
ezpublish.view.builder_parameter_collector.request_attributes:
236238
class: eZ\Publish\Core\MVC\Symfony\View\Builder\ParametersFilter\RequestAttributes

eZ/Publish/Core/MVC/Symfony/View/Builder/Registry/ControllerMatch.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ class ControllerMatch implements ViewBuilderRegistry
1717
/** @var \eZ\Publish\Core\MVC\Symfony\View\Builder\ViewBuilder[] */
1818
private $registry = [];
1919

20+
public function __construct(iterable $viewBuilders = [])
21+
{
22+
$toAdd = [];
23+
foreach ($viewBuilders as $viewBuilder) {
24+
$toAdd[] = $viewBuilder;
25+
}
26+
$this->addToRegistry($toAdd);
27+
}
28+
2029
/**
2130
* @param \eZ\Publish\Core\MVC\Symfony\View\Builder\ViewBuilder[] $viewBuilders
2231
*/

0 commit comments

Comments
 (0)