{% extends "forms/field.html.twig" %} {% set value = (value is null ? field.default : value) %} {% set name = field.name %} {% set btnLabel = field.btnLabel is defined ? field.btnLabel : "PLUGIN_ADMIN.ADD_ITEM" %} {% set btnSortLabel = field.btnSortLabel is defined ? field.btnSortLabel : "PLUGIN_ADMIN.SORT_BY" %} {% set fieldControls = field.controls|default('bottom') %} {% block contents %}
{% if field.toggleable %} {% endif %} {% if field.help %} {{ field.label|t }} {% else %} {{ field.label|t }} {% endif %} {{ field.validate.required in ['on', 'true', 1] ? '*' }}
{% if fieldControls in ['top', 'both'] %}
{% if collapsible %} {% endif %} {% if field.sortby %} {% endif %}
{% endif %} {% if fieldControls in ['bottom', 'both'] %}
{% if collapsible %} {% endif %} {% if field.sortby %} {% endif %}
{% endif %} {% set template %} {%- set item_name = name ? name ~ '.*' : '*' -%}
  • {% if field.sort is not same as(false) %}
    {% endif %} {%- if field.fields -%} {%- for child_name, child in field.fields -%} {% set child = prepare_form_field(child, child_name, item_name) %} {% if child %} {% set child = child|merge({ '_list_index': item_name }) %} {% set default_layout = 'text' %} {% if child.type == 'key' or child.key == true %} {# Special handling for the key field #} {% set default_layout = 'key' %} {% elseif child.name == 'value' %} {# Special handling for the value field #} {% set child = child|merge({ name: item_name }) %} {% endif %} {% set field_templates = include_form_field(child.type, field_layout, default_layout) %} {% include field_templates with { field: child, value: null } %} {% endif %} {%- endfor %}
    {% if collapsible %}
    {% endif %}
    {%- endif -%}
  • {% endset %}
    {% endblock %}