Skip to content

Commit

Permalink
EZP-32067: ViewBuilder now accepts tagged services
Browse files Browse the repository at this point in the history
  • Loading branch information
ViniTou committed Oct 22, 2020
1 parent 03413cc commit 203a7e6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 4 additions & 2 deletions eZ/Bundle/EzPublishCoreBundle/Resources/config/templating.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ services:

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

ezpublish.view_builder.content:
class: eZ\Publish\Core\MVC\Symfony\View\Builder\ContentViewBuilder
Expand All @@ -231,6 +231,8 @@ services:
- "@ezpublish.view.view_parameters.injector.dispatcher"
- "@request_stack"
- "@ezpublish.content_info_location_loader.main"
tags:
- { name: ibexa.view_builder }

ezpublish.view.builder_parameter_collector.request_attributes:
class: eZ\Publish\Core\MVC\Symfony\View\Builder\ParametersFilter\RequestAttributes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ class ControllerMatch implements ViewBuilderRegistry
/** @var \eZ\Publish\Core\MVC\Symfony\View\Builder\ViewBuilder[] */
private $registry = [];

public function __construct(iterable $viewBuilders = [])
{
$toAdd = [];
foreach ($viewBuilders as $viewBuilder) {
$toAdd[] = $viewBuilder;
}
$this->addToRegistry($toAdd);
}

/**
* @param \eZ\Publish\Core\MVC\Symfony\View\Builder\ViewBuilder[] $viewBuilders
*/
Expand Down

0 comments on commit 203a7e6

Please # to comment.