Explorar el Código

Only show items in the dropdown menu if either create or list action is available and granted.

Michel Weimerskirch hace 13 años
padre
commit
241bafe51e
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  1. 3 1
      Resources/views/standard_layout.html.twig

+ 3 - 1
Resources/views/standard_layout.html.twig

@@ -90,7 +90,9 @@ file that was distributed with this source code.
                                             <a href="#" class="dropdown-toggle">{{ group.label|trans({}, 'SonataAdminBundle') }}</a>
                                             <ul class="dropdown-menu">
                                                 {% for admin in group.items %}
-                                                    <li><a href="{{ admin.generateUrl('list')}}">{{ admin.label|trans({}, admin.translationdomain) }}</a></li>
+                                                    {% if admin.hasroute('create') and admin.isGranted('CREATE') or admin.hasroute('list') and admin.isGranted('LIST') %}
+                                                        <li><a href="{{ admin.generateUrl('list')}}">{{ admin.label|trans({}, admin.translationdomain) }}</a></li>
+                                                    {% endif %}
                                                 {% endfor %}
                                             </ul>
                                         </li>