{# Creates all the markup required for an custom key/value input. These are usually used to let the user provide custom meta data. Each "field" has three inputs one for the key, one for the value and a checkbox to remove it. So the arguments for this macro are nearly all tuples containing values for the (key, value, delete) fields respectively. names - A tuple of names for the three fields. values - A tuple of values for the (key, value, delete) fields. If delete is truthy the checkbox will be checked. error - A list of error strings for the field or just true to highlight the field. is_required - Boolean of whether this input is required for the form to validate Examples: {% import 'macros/form.html' as form %} {{ form.custom( names=('custom_key', 'custom_value', 'custom_deleted'), id='field-custom', label=_('Custom Field'), values=(extra.key, extra.value, extra.deleted), error='' ) }} #} {% macro custom(names=(), id="", label="", values=(), placeholders=(), error="", classes=[], attrs={}, is_required=false, key_values=()) %} {%- set extra_html = caller() if caller -%} {{ ui.extra_field(extra_html, data={"key": values[0], "value": values[1], "deleted": values[2]}, errors=error, name_template=names[0][:-3]) }} {% endmacro %}