diff --git a/src/bundle/Resources/config/services/components.yaml b/src/bundle/Resources/config/services/components.yaml index 6133d6f215..890c5dacf4 100644 --- a/src/bundle/Resources/config/services/components.yaml +++ b/src/bundle/Resources/config/services/components.yaml @@ -39,3 +39,10 @@ services: public: false Ibexa\Contracts\AdminUi\Component\Renderer\RendererInterface: '@Ibexa\AdminUi\Component\Renderer\DefaultRenderer' + + ibexa.adminui.layout.content.after: + parent: Ibexa\AdminUi\Component\TwigComponent + arguments: + $template: '@@ibexadesign/ui/layout_content_after.html.twig' + tags: + - { name: ibexa.admin_ui.component, group: 'layout-content-after' } diff --git a/src/bundle/Resources/config/services/ui_config/common.yaml b/src/bundle/Resources/config/services/ui_config/common.yaml index 316a31fc35..8ba39dd7c1 100644 --- a/src/bundle/Resources/config/services/ui_config/common.yaml +++ b/src/bundle/Resources/config/services/ui_config/common.yaml @@ -96,6 +96,8 @@ services: Ibexa\Bundle\AdminUi\Templating\Twig\ContentTypeIconExtension: ~ + Ibexa\Bundle\AdminUi\Templating\Twig\EmbeddedItemEditFormExtension: ~ + Ibexa\AdminUi\UI\Config\Provider\UserContentTypes: tags: - { name: ibexa.admin_ui.config.provider, key: 'userContentTypes' } diff --git a/src/bundle/Resources/views/themes/admin/ui/layout.html.twig b/src/bundle/Resources/views/themes/admin/ui/layout.html.twig index 07b5a39a74..dcd0b6c36c 100644 --- a/src/bundle/Resources/views/themes/admin/ui/layout.html.twig +++ b/src/bundle/Resources/views/themes/admin/ui/layout.html.twig @@ -221,6 +221,8 @@ {% endblock %} {% endif %} + {{ ibexa_render_component_group('layout-content-after') }} + {{ encore_entry_script_tags('ibexa-admin-ui-layout-js', null, 'ibexa') }} {{ encore_entry_script_tags('ibexa-admin-ui-udw-tabs-js', null, 'ibexa') }} {{ encore_entry_script_tags('ibexa-admin-ui-udw-extras-js', null, 'ibexa') }} diff --git a/src/bundle/Resources/views/themes/admin/ui/layout_content_after.html.twig b/src/bundle/Resources/views/themes/admin/ui/layout_content_after.html.twig new file mode 100644 index 0000000000..4e7eec2e56 --- /dev/null +++ b/src/bundle/Resources/views/themes/admin/ui/layout_content_after.html.twig @@ -0,0 +1,22 @@ +
diff --git a/src/bundle/Templating/Twig/EmbeddedItemEditFormExtension.php b/src/bundle/Templating/Twig/EmbeddedItemEditFormExtension.php new file mode 100644 index 0000000000..4e00a8aa89 --- /dev/null +++ b/src/bundle/Templating/Twig/EmbeddedItemEditFormExtension.php @@ -0,0 +1,55 @@ +formFactory = $formFactory; + $this->router = $router; + } + + public function getFunctions(): array + { + return [ + new TwigFunction( + 'ibexa_render_embedded_item_edit_form', + [$this, 'renderEmbeddedItemEditForm'] + ), + ]; + } + + public function renderEmbeddedItemEditForm(): FormView + { + return $this->formFactory->contentEdit( + new ContentEditData(), + 'embedded_item_edit', + [ + 'action' => $this->router->generate('ibexa.content.edit'), + 'attr' => [ + 'class' => 'ibexa-embedded-item-edit', + ], + ] + )->createView(); + } +} diff --git a/tests/bundle/Templating/Twig/EmbeddedItemEditFormExtensionTest.php b/tests/bundle/Templating/Twig/EmbeddedItemEditFormExtensionTest.php new file mode 100644 index 0000000000..97371e8666 --- /dev/null +++ b/tests/bundle/Templating/Twig/EmbeddedItemEditFormExtensionTest.php @@ -0,0 +1,108 @@ +createFormFactory(), + $this->createRouter() + ), + ]; + } + + /** + * @dataProvider getLegacyTests + * @group legacy + * + * @param string $file + * @param string $message + * @param string $condition + * @param array