{% extends "base_template.html" %} {% block title %}{{ _('Edit profile') }}{% endblock %} {% block content %}

{{ _('Edit profile') }}

{% with messages = get_flashed_messages(with_categories=true) %} {% if messages %} {% for category, message in messages %}
{% endfor %} {% endif %} {% endwith %}
{{ form.hidden_tag() }} {# Every visible field of the form, in order, so the fields other features register (an affiliation, say) are asked for too. A field this page has no placeholder for keeps its own render_kw. #} {% set placeholders = { 'name': _('Enter your name'), 'surname': _('Enter your surname'), } %} {% for field in form if field.widget.input_type not in ('hidden', 'submit') %} {% set known = {} %} {% if field.short_name in placeholders %} {% set known = {'placeholder': placeholders[field.short_name]} %} {% endif %} {% if field.widget.input_type == 'checkbox' %}
{{ field(class="form-check-input" ~ (" is-invalid" if field.errors else "")) }} {{ field.label(class="form-check-label") }} {% else %}
{{ field.label(class="form-label") }} {{ field(class="form-control" ~ (" is-invalid" if field.errors else ""), **known) }} {% endif %} {% if field.description %}

{{ field.description }}

{% endif %} {% for error in field.errors %} {{ error }}
{% endfor %}
{% endfor %}
{{ form.submit(class="btn btn-primary") }}
{# What other features add below the form: linked accounts, notification preferences and the like. Each section is a block of its own, with its own forms if it needs them, which is why it sits outside the profile form. Drawn only when a callback returns something. #} {% set sections = render_template_hooks("profile.edit.sections") %} {% if sections %}
{{ sections }}
{% endif %} {% endblock %}