{% macro widget(spec, value, errors, choices, readonly, prefix="", autocomplete_url="", file_url="", html_required=true) %} {% set name = prefix ~ spec.name %} {% set widget_type = spec.options.get('widget', spec.type.widget) %} {% set placeholder = spec.options.get('placeholder') %}
{% if spec.options.get('widget_template') %} {% include spec.options.get('widget_template') %} {% elif widget_type == 'checkbox' %} {% elif widget_type in ('select', 'multiselect') %} {% set multiple = widget_type == 'multiselect' %} {% if multiple %}{% endif %}
{% elif widget_type == 'textarea' or widget_type == 'json' %} {% elif widget_type == 'file' %} {% if value and file_url %}Current file: {{ value.split('/')[-1] }}{% endif %} {% elif widget_type == 'number' %} {% else %} {% endif %} {% if spec.help_text %}{{ spec.help_text }}{% endif %} {% for error in errors or [] %}
{{ error }}
{% endfor %} {% endmacro %}