{% if form.hasMultiplePages and form.settings.displayPageTabs %}
    {% formtag 'pageTabs' %}
        {% for page in form.pages %}
            {% formtag 'pageTab' %}
                {%- set pageIndex = loop.index0 -%}
                {%- set params = { handle: form.handle, pageId: page.id } -%}

                {%- if form.getSessionKey() -%}
                    {%- set params = params | merge({ sessionKey: form.getSessionKey() }) -%}
                {%- endif -%}

                {%- if submission and submission.id and form.isEditingSubmission() -%}
                    {%- set params = params | merge({ submissionId: submission.id }) -%}
                {%- endif -%}

                {{ formtag('pageTabLink', {
                    text: page.label | t('formie'),
                }) }}
            {% endformtag %}
        {% endfor %}
    {% endformtag %}
{% endif %}