{% import 'macros/form.html' as form %} {% include 'scheming/snippets/suggestions_asset.html' %} {# Check if this is a preformulated field #} {% set is_preformulated = h.is_preformulated_field(field) %} {# Create a custom label with suggestion button(s) and icons #} {% set suggestion = h.scheming_field_suggestion(field) %} {% set label_text = h.scheming_language_text(field.label) %} {% set label_with_extras %} {{ label_text }}: {%- if suggestion -%} {%- snippet 'scheming/snippets/suggestion_button.html', field=field, data=data -%} {%- endif -%} {%- if is_preformulated -%} {%- endif -%} {% endset %} {# Prepare attributes for the form macro #} {% set current_attrs = {} %} {% if supports_ai_suggestion %} {% set _ = current_attrs.update({'data-field-supports-ai-suggestion': 'true'}) %} {% endif %} {% if is_preformulated %} {# is_preformulated means it has a 'formula' #} {% set _ = current_attrs.update({'data-is-formula-field': 'true'}) %} {% endif %} {# Always add data-scheming-field-name for easier targeting by JS #} {% set _ = current_attrs.update({'data-scheming-field-name': field.field_name}) %} {% call form.markdown( field.field_name, id='field-' + field.field_name, label=label_with_extras|safe, placeholder=h.scheming_language_text(field.form_placeholder), value=data[field.field_name], error=errors[field.field_name], attrs=current_attrs, is_required=h.scheming_field_required(field) ) %}
{%- if is_preformulated -%}
Automated field: This field is automatically populated.
{%- endif -%} {%- snippet 'scheming/form_snippets/help_text.html', field=field -%}
{% endcall %}