{# This file was part of Flask-Bootstrap and was modified under the terms of its BSD License. Copyright (c) 2013, Marc Brinkmann. All rights reserved. #} {# This file was part of Bootstrap-Flask and was modified under the terms of its MIT License. Copyright (c) 2018 Grey Li. All rights reserved.#} {% macro render_ui_hidden_errors(form, hiddens=True) %} {%- if form.errors %}
{%- endif %} {%- endmacro %} {% macro render_ui_field(field, form_type="basic", inverted=None, horizontal_columns=('sixteen', 'sixteen', 'sixteen'), button_map={}, button_style='', button_size='') %} {# this is a workaround hack for the more straightforward-code of just passing required=required parameter. older versions of wtforms do not have the necessary fix for required=False attributes, but will also not set the required flag in the first place. we skirt the issue using the code below #} {% if field.flags.required and not required in kwargs %} {% set kwargs = dict(required=True, **kwargs) %} {% endif %} {# combine render_kw class or class/class_ argument with Bootstrap classes #} {% set render_kw_class = '' + field.render_kw.class if field.render_kw.class else '' %} {% set class = kwargs.pop('class', '') or kwargs.pop('class_', '') %} {% set default_error_header = config.FOMANTIC_ERROR_HEADER %} {% set checkbox_error_header = config.FOMANTIC_CHECKBOX_HEADER_ERROR %} {% set radio_error_header = config.FOMANTIC_RADIO_HEADER_ERROR %} {% if class %} {# override render_kw class when class/class_ presents as keyword argument #} {% set render_kw_class = '' %} {% set render_kw_class_ = '' %} {% set class = '' + class %} {% endif %} {% set extra_classes = render_kw_class + class %} {% if field.widget.input_type == 'checkbox' %} {% set field_kwargs = kwargs %}