diff --git a/src/bundle/Controller/ContentTypeGroupController.php b/src/bundle/Controller/ContentTypeGroupController.php index 45e3641522..4ea1395c25 100644 --- a/src/bundle/Controller/ContentTypeGroupController.php +++ b/src/bundle/Controller/ContentTypeGroupController.php @@ -273,6 +273,7 @@ public function viewAction(Request $request, ContentTypeGroup $group, int $page 'content_type_group' => $group, 'page' => $page, 'route_name' => $request->get('_route'), + 'can_create' => $this->isGranted(new Attribute('class', 'create')), ]); } diff --git a/src/bundle/Resources/translations/content_type.en.xliff b/src/bundle/Resources/translations/content_type.en.xliff index c125e973b3..3eacac66f8 100644 --- a/src/bundle/Resources/translations/content_type.en.xliff +++ b/src/bundle/Resources/translations/content_type.en.xliff @@ -331,6 +331,11 @@ Some of the Fields are disabled when translating a Content Type. To modify them, edit the Content Type in the main language. key: content_type.view.edit.notranslatable_fields_disabled + + Create + Create + key: content_type.view.list.action.add + You cannot delete the disabled Content Types, because Content items of those types exist. You cannot delete the disabled Content Types, because Content items of those types exist. diff --git a/src/bundle/Resources/views/themes/admin/content_type/content_type_group/index.html.twig b/src/bundle/Resources/views/themes/admin/content_type/content_type_group/index.html.twig index 5485b876b6..a1c50e92bc 100644 --- a/src/bundle/Resources/views/themes/admin/content_type/content_type_group/index.html.twig +++ b/src/bundle/Resources/views/themes/admin/content_type/content_type_group/index.html.twig @@ -18,6 +18,30 @@ } %} {% endblock %} +{% block context_menu %} + {% set menu_items %} + {% if can_create %} +
  • + + + + + + {{ 'content_type.view.list.action.add'|trans|desc('Create') }} + + +
  • + {% endif %} + {% endset %} + + {{ include('@ibexadesign/ui/component/context_menu/context_menu.html.twig', { + menu_items: menu_items, + }) }} +{% endblock %} + {% block content %} {{ render(controller('Ibexa\\Bundle\\AdminUi\\Controller\\ContentTypeController::listAction', { contentTypeGroupId: content_type_group.id, diff --git a/src/bundle/Resources/views/themes/admin/content_type/list.html.twig b/src/bundle/Resources/views/themes/admin/content_type/list.html.twig index 1926333e6f..f57363e954 100644 --- a/src/bundle/Resources/views/themes/admin/content_type/list.html.twig +++ b/src/bundle/Resources/views/themes/admin/content_type/list.html.twig @@ -94,19 +94,6 @@ {% block header %} {% embed '@ibexadesign/ui/component/table/table_header.html.twig' %} {% block actions %} - {% if can_create %} - - - - - - {{ 'content_type.view.list.action.add'|trans|desc('Add new') }} - - - {% endif %} {% if can_delete %} {% set modal_data_target = 'delete-content-types-modal' %}