{% extends '_layouts/cp' %} {% import '_includes/forms' as forms %} {% import 'verbb-base/_macros' as macros %} {% set crumbs = [ { label: craft.formie.getPluginName() | t('formie'), url: url('formie') }, { label: 'Settings' | t('app'), url: url('formie/settings') }, { label: 'Stencils' | t('formie'), url: url('formie/settings/stencils') }, ] %} {% set selectedSubnavItem = 'settings' %} {% set bodyClass = 'fui-body' %} {% block pageTitle %}

${form.title}

{% endblock %} {% set errorSummary %}

${errorMessage}

{% endset %} {% block actionButton %}
{{ 'Save' | t('app') }}
{% endblock %} {% block content %} {# Capture any JS generated by the form builder that isn't Vue. Think elementSelect fields. #} {% do craft.app.view.startJsBuffer() %}
{% if stencil.id %} {% endif %} {% for tab in tabs %}
{% include ['formie/forms/_panes/' ~ tab.value, 'formie/forms/_panes/form-fields'] %}
{% endfor %}
{# Wait for the `formie-form.js` file to load (via Vite) before initializing the Vue app. #} {# Once ready, initialized any captured JS _after_ Vue has loaded. This handles all jQuery-based scripts #} {% set jsBuffer = craft.app.view.clearJsBuffer(false) %} {% js %} document.addEventListener('vite-script-loaded', function(e) { if (e.detail.path === 'src/js/formie-form.js') { new Craft.Formie.EditForm({{ jsBuilderConfig | json_encode | raw }}); // Wait for Vue to kick in setTimeout(function() { {{ jsBuffer | raw }} }, 100); } }); {% endjs %} {% endblock %}