Details
-
Story
-
Resolution: Unresolved
-
Medium
-
None
-
3.0.0-beta5
-
2
Description
View builder is a service which is used to build instances of Views (\eZ\Publish\Core\MVC\Symfony\View\View) to be able to e.g. pass ContentView to a controller as its parameter.
There's a registry which gets a specific ViewBuilder for a given Controller, however right now to be able to add a Builder to that registry, a custom compiler pass is required, as it's done so for AdminUI, SupportTools, User Bundle, or RepositoryForms.
This should not be so complicated (and so WET BTW.).
What is needed is a simple DI, so our and 3rd party View Builders can be tagged using ezplatform.spi.view_builder tag.
E.g.:
EzSystems\EzPlatformAdminUi\View\Builder\ContentTranslateViewBuilder: tags: - { name: ezplatform.spi.view_builder }
It's so simple it can be even registered for auto-configuration, so it's enough to just register a service implementing \eZ\Publish\Core\MVC\Symfony\View\Builder\ViewBuilder with autowire: true attribute.