{# Creates all the markup required for an input element. Handles matching labels to inputs, error messages and other useful elements. name - The name of the form parameter. id - The id to use on the input and label. Convention is to prefix with 'field-'. label - The human readable label. value - The value of the input. placeholder - Some placeholder text. type - The type of input eg. email, url, date (default: text). error - A list of error strings for the field or just true to highlight the field. classes - An array of classes to apply to the form-group. is_required - Boolean of whether this input is required for the form to validate Examples: {% import 'macros/form.html' as form %} {{ form.input('title', label=_('Title'), value=data.title, error=errors.title) }} #} {% macro input(name, id='', label='', value='', placeholder='', type='text', icon="", error="", classes=[], attrs={}, is_required=false) %} {%- set extra_html = caller() if caller -%} {{ ui.input(extra_html, name=name, id=id, label=label, value=value, placeholder=placeholder, type=type, icon=icon, errors=error, attrs=attrs, required=is_required) }} {% endmacro %}