From 353b6bc79c90d8e4d43c3945df46985fd0b5e1f2 Mon Sep 17 00:00:00 2001 From: Johannes Quack <33766870+Jaykju@users.noreply.github.com> Date: Thu, 19 Oct 2023 22:38:01 +0200 Subject: [PATCH] Fix fields when entity permissions are applied --- src/Resources/views/crud/index.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Resources/views/crud/index.html.twig b/src/Resources/views/crud/index.html.twig index e873ea36b2..f6266d1d1c 100644 --- a/src/Resources/views/crud/index.html.twig +++ b/src/Resources/views/crud/index.html.twig @@ -107,7 +107,7 @@ {% set ea_sort_asc = constant('EasyCorp\\Bundle\\EasyAdminBundle\\Config\\Option\\SortOrder::ASC') %} {% set ea_sort_desc = constant('EasyCorp\\Bundle\\EasyAdminBundle\\Config\\Option\\SortOrder::DESC') %} - {% for field in entities|first.fields ?? [] %} + {% for field in entities|filter(e => e.isAccessible)|first.fields ?? [] %} {% set is_sorting_field = ea.search.isSortingField(field.property) %} {% set next_sort_direction = is_sorting_field ? (ea.search.sortDirection(field.property) == ea_sort_desc ? ea_sort_asc : ea_sort_desc) : ea_sort_desc %} {% set column_icon = is_sorting_field ? (next_sort_direction == ea_sort_desc ? 'fa-arrow-up' : 'fa-arrow-down') : 'fa-sort' %}