{#- What a role grants: a row for each view and page, a column for each permission, and at the end the permissions a view's own actions ask for. The boxes keep one hidden input up to date with the JSON the field reads, so the form sends what is ticked. -#} {%- set grid = row.field.grid(row.value) -%} {%- set grid_id = "field-" ~ (row.id_prefix ~ row.path)|replace(".", "-") -%} {%- set width = grid.columns|length + (2 if grid.has_actions else 1) -%}
{#- As wide as what it holds, so a phone scrolls it rather than breaking every label over several lines. -#} {% for permission, label in grid.columns %} {% endfor %} {% if grid.has_actions %} {% endif %} {% for group in grid.groups %} {% set group_index = loop.index %} {% if group.label %} {% endif %} {% for line in group.lines %} {% set line_id = grid_id ~ "-" ~ group_index ~ "-" ~ loop.index %} {% for box in line.boxes %} {% endfor %} {% if grid.has_actions %} {% endif %} {% endfor %} {% endfor %}
{{ label }}{{ _('Actions') }}
{{ group.label }}
{{ line.label }} {% if box %} {% endif %}
{% for box in line.actions %} {% set action_id = line_id ~ "-action-" ~ loop.index %} {% endfor %}