Skip to content

Commit

Permalink
IBX-7914: Added possibility to use another template (#1201)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikadamczyk authored Mar 14, 2024
1 parent 36501e8 commit 7ed8eb2
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/bundle/Controller/ContentTypeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down

0 comments on commit 7ed8eb2

Please sign in to comment.