{#- Each widget lives in widgets/, so a project can override one by dropping a file with the same name into its own template folder. -#} {% import "adminsite/_icons.html" as icons %} {%- set field_id = "field-" ~ (row.id_prefix ~ row.path)|replace(".", "-") -%} {#- Ties the input to its name, and to its error or help, for screen readers. -#} {%- set field_attrs -%} aria-labelledby="{{ field_id }}-label" {%- if row.error or row.note %} aria-describedby="{{ field_id }}-note"{% endif %} {%- if row.error %} aria-invalid="true"{% endif %} {%- endset -%} {#- An input as wide as what it holds: a number or a date short, a line of text longer, long text, files and many values the whole width. -#} {%- set full = row.widget in ("textarea", "json", "file", "image", "list") or row.field.collection|default(false) or row.field.multiple|default(false) -%} {%- set short = row.widget in ("number", "date", "time", "datetime") -%} {#- A document drawn as a form switches between the form and its JSON. -#} {%- set document = row.document if row.document is defined else none -%} {#- A new record's document whose schema follows the rest of the form is drawn again when something outside it changes. -#}