vendor/sonata-project/admin-bundle/src/Resources/views/Core/add_block.html.twig line 1

Open in your IDE?
  1. {% block user_block %}
  2.     {% set items_per_column = sonata_admin.adminPool.getOption('dropdown_number_groups_per_colums') %}
  3.     {% set groups = [] %}
  4.     {% for group in sonata_admin.adminPool.dashboardgroups|filter(group => group.items|filter(admin => admin.hasRoute('create') and admin.hasAccess('create'))|length > 0) %}
  5.         {% set groups = [group]|merge(groups) %}
  6.     {% endfor %}
  7.     {% set column_count = (groups|length / items_per_column)|round(0, 'ceil') %}
  8.     <div class="dropdown-menu multi-column dropdown-add"
  9.         {% if column_count > 1 %}style="width: {{ column_count*140 }}px;"{% endif %}
  10.     >
  11.         {% for group in groups|reverse %}
  12.             {% set display = group.roles is empty or is_granted(sonata_admin.adminPool.getOption('role_admin')) or group.roles|filter(role => is_granted(role))|length > 0 %}
  13.             {% if loop.first %}
  14.                 {% set render_first_element = true %}
  15.             {% endif %}
  16.             {% if display %}
  17.                 {% if render_first_element or loop.index0 % items_per_column == 0 %}
  18.                     {% if render_first_element %}
  19.                         <div class="container-fluid">
  20.                             <div class="row">
  21.                         {% set render_first_element = false %}
  22.                     {% else %}
  23.                         </ul>
  24.                     {% endif %}
  25.                     <ul class="dropdown-menu{% if column_count > 1 %} col-md-{{ (12/column_count)|round }}{% endif %}">
  26.                 {% endif %}
  27.                 {% if loop.index0 % items_per_column != 0 %}
  28.                     <li role="presentation" class="divider"></li>
  29.                 {% endif %}
  30.                 <li role="presentation" class="dropdown-header">
  31.                     {{ group.icon|raw }}
  32.                     {{ group.label|trans({}, group.label_catalogue) }}
  33.                 </li>
  34.                 {% for admin in group.items %}
  35.                     {% if admin.hasRoute('create') and admin.hasAccess('create') %}
  36.                         {% if admin.subClasses is empty %}
  37.                             <li role="presentation">
  38.                                 <a role="menuitem" tabindex="-1" href="{{ admin.generateUrl('create') }}">{{ admin.label|trans({}, admin.translationdomain) }}</a>
  39.                             </li>
  40.                         {% else %}
  41.                             {% for subclass in admin.subclasses|keys %}
  42.                                 <li role="presentation">
  43.                                     <a role="menuitem" tabindex="-1" href="{{ admin.generateUrl('create', {'subclass': subclass}) }}">{{ subclass|trans({}, admin.translationdomain) }}</a>
  44.                                 </li>
  45.                             {% endfor %}
  46.                         {% endif %}
  47.                     {% endif %}
  48.                 {% endfor %}
  49.                 {% if loop.last and not render_first_element %}
  50.                     </ul>
  51.                     </div>
  52.                     </div>
  53.                 {% endif %}
  54.             {% endif %}
  55.         {% endfor %}
  56.     </div>
  57. {% endblock %}