From 365248eccb78c1f9044da51fcc9d581d67a06c46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20CROMBEZ?= <777666+jcrombez@users.noreply.github.com> Date: Tue, 12 Dec 2023 16:40:01 +0100 Subject: [PATCH] hide column name prefixed by "_" --- .../theme/bootstrap5/datagrid-table.html.twig | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/Resources/views/theme/bootstrap5/datagrid-table.html.twig b/src/Resources/views/theme/bootstrap5/datagrid-table.html.twig index 6ea0af5..96bcc6f 100644 --- a/src/Resources/views/theme/bootstrap5/datagrid-table.html.twig +++ b/src/Resources/views/theme/bootstrap5/datagrid-table.html.twig @@ -22,17 +22,19 @@ {% endif %} - {% if column.sortable is not null %} - {% set sortUrl = path( - grid.pagination.route, - grid.pagination.params|merge({ - 'sort_by': column.sortable, - 'sort_order': app.request.get('sort_order') == 'ASC' ? 'DESC' : 'ASC' - }) - ) %} - {{ column.name }} - {% else %} - {{ column.name }} + {% if not (column.name starts with '_') %} + {% if column.sortable is not null %} + {% set sortUrl = path( + grid.pagination.route, + grid.pagination.params|merge({ + 'sort_by': column.sortable, + 'sort_order': app.request.get('sort_order') == 'ASC' ? 'DESC' : 'ASC' + }) + ) %} + {{ column.name }} + {% else %} + {{ column.name }} + {% endif %} {% endif %} {% endfor %}