{% extends '@WebProfiler/Profiler/layout.html.twig' %} {% from _self import form_tree_entry, form_tree_details %} {% block toolbar %} {% if collector.data.nb_errors > 0 or collector.data.forms|length %} {% set status_color = collector.data.nb_errors ? 'red' %} {% set icon %} {{ source('@WebProfiler/Icon/form.svg') }} {{ collector.data.nb_errors ?: collector.data.forms|length }} {% endset %} {% set text %}
Number of forms {{ collector.data.forms|length }}
Number of errors {{ collector.data.nb_errors }}
{% endset %} {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url, status: status_color }) }} {% endif %} {% endblock %} {% block menu %} {{ source('@WebProfiler/Icon/form.svg') }} Forms {% if collector.data.nb_errors > 0 %} {{ collector.data.nb_errors }} {% endif %} {% endblock %} {% block head %} {{ parent() }} {% endblock %} {% block panel %}

Forms

{% if collector.data.forms|length %}
{% for formName, formData in collector.data.forms %} {{ form_tree_details(formName, formData, collector.data.forms_by_hash, loop.first) }} {% endfor %}
{% else %}

No forms were submitted for this request.

{% endif %} {% endblock %} {% macro form_tree_entry(name, data, is_root) %} {% import _self as tree %} {% set has_error = data.errors is defined and data.errors|length > 0 %}
  • {% if has_error %}
    {{ data.errors|length }}
    {% endif %} {% if data.children is not empty %} {% else %}
    {% endif %} {{ name|default('(no name)') }}
    {% if data.children is not empty %} {% endif %}
  • {% endmacro %} {% macro form_tree_details(name, data, forms_by_hash, show) %} {% import _self as tree %}

    {{ name|default('(no name)') }}

    {% if data.type_class is defined %}
    Form type: {{ profiler_dump(data.type_class) }}
    {% endif %} {% set form_has_errors = data.errors ?? [] is not empty %}

    Errors

    {{ _self.render_form_errors(data) }}

    Default Data

    {{ _self.render_form_default_data(data) }}

    Submitted Data

    {{ _self.render_form_submitted_data(data) }}

    Passed Options

    {{ _self.render_form_passed_options(data) }}

    Resolved Options

    {{ _self.render_form_resolved_options(data) }}

    View Vars

    {{ _self.render_form_view_variables(data) }}
    {% for childName, childData in data.children %} {{ tree.form_tree_details(childName, childData, forms_by_hash) }} {% endfor %} {% endmacro %} {% macro render_form_errors(data) %} {% if data.errors is defined and data.errors|length > 0 %}

    Errors

    {% for error in data.errors %} {% endfor %}
    Message Origin Cause
    {{ error.message }} {% if error.origin is empty %} This form. {% elseif forms_by_hash[error.origin] is not defined %} Unknown. {% else %} {{ forms_by_hash[error.origin].name }} {% endif %} {% if error.trace %} Caused by: {% for stacked in error.trace %} {{ profiler_dump(stacked) }} {% endfor %} {% else %} Unknown. {% endif %}
    {% else %}

    This form has no errors.

    {% endif %} {% endmacro %} {% macro render_form_default_data(data) %} {% if data.default_data is defined %}
    Property Value
    Model Format {% if data.default_data.model is defined %} {{ profiler_dump(data.default_data.seek('model')) }} {% else %} same as normalized format {% endif %}
    Normalized Format {{ profiler_dump(data.default_data.seek('norm')) }}
    View Format {% if data.default_data.view is defined %} {{ profiler_dump(data.default_data.seek('view')) }} {% else %} same as normalized format {% endif %}
    {% else %}

    This form has default data defined.

    {% endif %} {% endmacro %} {% macro render_form_submitted_data(data) %} {% if data.submitted_data.norm is defined %}
    Property Value
    View Format {% if data.submitted_data.view is defined %} {{ profiler_dump(data.submitted_data.seek('view')) }} {% else %} same as normalized format {% endif %}
    Normalized Format {{ profiler_dump(data.submitted_data.seek('norm')) }}
    Model Format {% if data.submitted_data.model is defined %} {{ profiler_dump(data.submitted_data.seek('model')) }} {% else %} same as normalized format {% endif %}
    {% else %}

    This form was not submitted.

    {% endif %} {% endmacro %} {% macro render_form_passed_options(data) %} {% if data.passed_options ?? [] is not empty %} {% for option, value in data.passed_options %} {% endfor %}
    Option Passed Value Resolved Value
    {{ option }} {{ profiler_dump(value) }} {# values can be stubs #} {% set option_value = value.value|default(value) %} {% set resolved_option_value = data.resolved_options[option].value|default(data.resolved_options[option]) %} {% if resolved_option_value == option_value %} same as passed value {% else %} {{ profiler_dump(data.resolved_options.seek(option)) }} {% endif %}
    {% else %}

    No options were passed when constructing this form.

    {% endif %} {% endmacro %} {% macro render_form_resolved_options(data) %} {% for option, value in data.resolved_options ?? [] %} {% endfor %}
    Option Value
    {{ option }} {{ profiler_dump(value) }}
    {% endmacro %} {% macro render_form_view_variables(data) %} {% for variable, value in data.view_vars ?? [] %} {% endfor %}
    Variable Value
    {{ variable }} {{ profiler_dump(value) }}
    {% endmacro %}