forked from ezsystems/repository-forms
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EZP-28849: Allow repository forms to use View Manager for handling dr…
…aft edit controller and template dispatching (ezsystems#215)
- Loading branch information
Showing
12 changed files
with
662 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
bundle/DependencyInjection/Compiler/ViewBuilderRegistryPass.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
/** | ||
* This file is part of the eZ RepositoryForms package. | ||
* | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
namespace EzSystems\RepositoryFormsBundle\DependencyInjection\Compiler; | ||
|
||
use EzSystems\RepositoryForms\Content\View\Builder\ContentEditViewBuilder; | ||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
|
||
/** | ||
* Compiler pass to add View Builders to ViewBuilderRegistry. | ||
*/ | ||
class ViewBuilderRegistryPass implements CompilerPassInterface | ||
{ | ||
const VIEW_BUILDER_REGISTRY = 'ezpublish.view_builder.registry'; | ||
const VIEW_BUILDER_CONTENT_EDIT = ContentEditViewBuilder::class; | ||
|
||
public function process(ContainerBuilder $container) | ||
{ | ||
if (!$container->hasDefinition(self::VIEW_BUILDER_REGISTRY) || !$container->hasDefinition(ContentEditViewBuilder::class)) { | ||
return; | ||
} | ||
|
||
$registry = $container->findDefinition(self::VIEW_BUILDER_REGISTRY); | ||
|
||
$viewBuilders = [ | ||
$container->getDefinition(self::VIEW_BUILDER_CONTENT_EDIT), | ||
]; | ||
|
||
$registry->addMethodCall('addToRegistry', [$viewBuilders]); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
bundle/DependencyInjection/Configuration/Parser/ContentEditView.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
/** | ||
* This file is part of the eZ RepositoryForms package. | ||
* | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
namespace EzSystems\RepositoryFormsBundle\DependencyInjection\Configuration\Parser; | ||
|
||
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\Parser\View; | ||
|
||
class ContentEditView extends View | ||
{ | ||
const NODE_KEY = 'content_edit_view'; | ||
const INFO = 'Template selection settings when displaying a content edit form'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
services: | ||
_defaults: | ||
public: false | ||
autowire: true | ||
autoconfigure: true | ||
|
||
EzSystems\RepositoryForms\Content\View\Builder\ContentEditViewBuilder: | ||
arguments: | ||
- '@ezpublish.api.repository' | ||
- '@ezpublish.view.configurator' | ||
- '@ezpublish.view.view_parameters.injector.dispatcher' | ||
- '$content_edit.templates.edit$' | ||
- '@ezrepoforms.action_dispatcher.content' | ||
|
||
EzSystems\RepositoryForms\Content\View\Provider\Configured: | ||
arguments: | ||
- '@ezplatform.repository_forms.content_edit_view.matcher_factory' | ||
tags: | ||
- { name: ezpublish.view_provider, type: EzSystems\RepositoryForms\Content\View\ContentEditView, priority: 10 } | ||
|
||
ezplatform.repository_forms.content_edit_view.matcher_factory: | ||
class: '%ezpublish.view.matcher_factory.class%' | ||
arguments: | ||
- '@ezpublish.api.repository' | ||
- 'eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased' | ||
calls: | ||
- [setContainer, ['@service_container']] | ||
- [setMatchConfig, ['$content_edit_view$']] | ||
|
||
EzSystems\RepositoryForms\Content\View\Filter\ContentEditViewFilter: | ||
arguments: | ||
- '@ezpublish.api.service.content' | ||
- '@ezpublish.api.service.content_type' | ||
tags: | ||
- { name: kernel.event_subscriber } |
Oops, something went wrong.