From 7ed8eb24abe6a39e731a8908c00ca631189237a8 Mon Sep 17 00:00:00 2001 From: Mikolaj Adamczyk Date: Thu, 14 Mar 2024 11:00:21 +0100 Subject: [PATCH] IBX-7914: Added possibility to use another template (#1201) --- src/bundle/Controller/ContentTypeController.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/bundle/Controller/ContentTypeController.php b/src/bundle/Controller/ContentTypeController.php index 7e8d5d7340..e01f8b7bdb 100644 --- a/src/bundle/Controller/ContentTypeController.php +++ b/src/bundle/Controller/ContentTypeController.php @@ -687,8 +687,11 @@ public function bulkDeleteAction(Request $request, ContentTypeGroup $group): Res * * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException */ - public function viewAction(ContentTypeGroup $group, ContentType $contentType): Response - { + public function viewAction( + ContentTypeGroup $group, + ContentType $contentType, + Request $request + ): Response { $fieldDefinitionsByGroup = []; foreach ($contentType->fieldDefinitions as $fieldDefinition) { $fieldDefinitionsByGroup[$fieldDefinition->fieldGroup ?: 'content'][] = $fieldDefinition; @@ -710,7 +713,9 @@ public function viewAction(ContentTypeGroup $group, ContentType $contentType): R $canUpdate = $this->isGranted(new Attribute('class', 'update')) && $this->isGranted(new Attribute('class', 'create')); - return $this->render('@ibexadesign/content_type/index.html.twig', [ + $view = $request->attributes->get('view_template') ?? '@ibexadesign/content_type/index.html.twig'; + + return $this->render($view, [ 'content_type_group' => $group, 'content_type' => $contentType, 'field_definitions_by_group' => $fieldDefinitionsByGroup,