{% import "_includes/forms" as forms %} {% includeCssResource 'supertable/css/SuperTableInput.css' %} {% set columnSettings = [] %} {% if settings is defined and settings %} {% for col in settings.columns %} {% set columnSettings = columnSettings | merge([col]) %} {% endfor %} {% endif %}
{% if table %} {% for index, field in table.getFields() %} {% if columnSettings[index] is defined %} {% set width = columnSettings[index].width %} {% if width %} {% if 'px' not in width and '%' not in width %} {% set width = width ~ '%' %} {% endif %} {% endif %} {% endif %} {% endfor %} {% endif %} {% if not settings.staticField %} {% endif %} {% set totalNewBlocks = 0 %} {% if settings.staticField %} {% if blocks %} {% set blocks = [blocks] %} {% endif %} {% endif %} {% for block in blocks %} {% set blockId = block.id %} {% if not blockId %} {% set totalNewBlocks = totalNewBlocks + 1 %} {% set blockId = 'new'~totalNewBlocks %} {% endif %} {% include "supertable/fields" with { namespace: name~'['~blockId~'][fields]', element: block, fields: block.getType().getFieldLayout().getFields(), settings: settings, } %} {% endfor %}
{{ field.name | t }} {% if field.instructions %}{{ field.instructions | t }}{% endif %}
{{ settings.selectionLabel | default("Add a row") | t }}