{#- A JSON column drawn as a form from its schema. `row.document` holds the parts: a single value is drawn like any other field, an object's properties sit under its title, and a list of objects or a map is a table whose rows can be added and removed. Form and JSON switch between the form and the document it stands for, as Save would write it. Every input's name says where its value sits in the document, so the form is sent like any other: settings.free_shipping_over, settings.channels.0.id. -#} {% import "adminsite/_icons.html" as icons %} {%- set document = row.document -%} {%- set json_id = "json-" ~ row.path -%} {%- macro value_part(entry) -%} {%- set row = entry.row -%} {% include "adminsite/_field.html" %} {%- endmacro -%} {#- One line of a table: a cell for each value, then its remove button. The first cell carries the row's marker, so a row whose inputs are all empty is still sent, and read as a row left unused. -#} {%- macro table_row(item, counted) -%}
{{ icons.icon("alert", 14) }}{{ cell.error }}
{% endif %}| {{ _('Key') }} | {{ _('Value') }} | {% else %} {% for column in entry.columns %}{{ column.label }}{% if not column.field.required and column.widget != "checkbox" %} {{ _('(optional)') }}{% endif %} | {% endfor %} {% endif %}{{ _('Remove') }} |
|---|
{{ icons.icon("alert", 14) }}{{ entry.error }}
{% elif entry.note %}{{ entry.note }}
{% endif %}{{ icons.icon("alert", 14) }}{{ entry.error }}
{% elif entry.note %}{{ entry.note }}
{% endif %}{{ _('Nothing set.') }}
{{ _('Nothing found.') }}
{{ _('Reading the form…') }}
{{ _('What Save writes. Switch back to Form to change it.') }}