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/Templating/Twig/EmbeddedItemEditFormExtension.php b/src/bundle/Templating/Twig/EmbeddedItemEditFormExtension.php new file mode 100644 index 0000000000..2ea759d786 --- /dev/null +++ b/src/bundle/Templating/Twig/EmbeddedItemEditFormExtension.php @@ -0,0 +1,52 @@ +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'), + ] + )->createView(); + } +}