{# Variables - form - description - formSettings - formNotes - callbackUrl - activeTab - formThemes (array) May include one or more form themes that need to be applied #} {%- form_theme form with formThemes -%} {%- set nSupportedFeatures = form.supportedFeatures is defined ? form.supportedFeatures|length : 0 -%} {%- set hasSupportedFeatures = nSupportedFeatures > 0 -%} {%- set nFeatureSettings = form.featureSettings is defined ? form.featureSettings|length : 0 -%} {%- set hasFields = ((formSettings.dynamic_contact_fields is defined and formSettings.dynamic_contact_fields is not empty) or form.featureSettings is defined) and form.featureSettings.leadFields|length > 0 -%} {# Unset if set to prevent features tab from showing when there's no feature to show #} {%- if not hasFields %}{% do form.featureSettings.leadFields.setRendered() %}{% set nFeatureSettings = nFeatureSettings - 1 %}{% endif -%} {%- set hideContactFieldTab = (hasFields and formSettings.dynamic_contact_fields is defined and formSettings.dynamic_contact_fields is not empty and form.featureSettings.leadFields|length == 0) -%} {%- set hasFeatureSettings = ( form.featureSettings is defined and ( (hasFields and nFeatureSettings > 1) or (not hasFields and nFeatureSettings > 0) ) ) -%} {%- if not hasFeatureSettings and form.featureSettings is defined %}{% do form.featureSettings.setRendered() %}{% endif -%} {%- set hasCompanyFields = form.featureSettings.companyFields is defined and form.featureSettings.companyFields|length > 0 -%} {%- set companyFieldHtml = hasCompanyFields ? form_row(form.featureSettings.companyFields) : '' -%} {%- set fieldHtml = hasFields ? form_row(form.featureSettings.leadFields) -%} {%- set fieldLabel = hasFields ? form.featureSettings.leadFields.vars.label -%} {%- set fieldTabClass = (hasFields and hideContactFieldTab == false) ?: 'hide' -%} {%- set hasLeadFieldErrors = hasFields and formContainsErrors(form.featureSettings.leadFields) -%} {%- set hasCompanyFieldErrors = hasCompanyFields and formContainsErrors(form.featureSettings.companyFields) -%} {%- if form.featureSettings.leadFields is defined %}{% do form.featureSettings.leadFields.setRendered() %}{% endif -%} {%- if form.featureSettings.companyFields is defined %}{% do form.featureSettings.companyFields.setRendered() %}{% endif -%} {%- if description is not empty -%}
{{- description|purify -}}
{%- endif -%} {{- form_start(form) -}}
{{- form_row(form.isPublished) -}} {%- if form.virtual is defined %}{{ form_row(form.virtual) }}{% endif %} {%- if form.apiKeys is defined -%} {{- form_row(form.apiKeys) -}} {%- if formNotes.authorization is defined -%}
{{- formNotes.authorization.note|purify -}}
{%- endif -%} {%- if form.apiKeys|length > 0 and callbackUrl is not empty -%}
{{- 'mautic.integration.callbackuri'|trans }}
{%- endif -%} {%- if form.authButton is defined -%}
{{- form_widget(form.authButton, {'attr': {'class': 'btn btn-success btn-lg'}}) -}}
{%- endif -%} {%- endif -%} {%- if formNotes.custom is defined -%} {%- if formNotes.custom is string -%} {{ formNotes.custom|purify }} {%- elseif formNotes.custom.custom is defined and formNotes.custom.template is string -%} {{ include(formNotes.custom.template, formNotes.custom.parameters|default([]), ignore_missing=true) }} {%- endif -%} {%- endif -%}
{%- if hasSupportedFeatures or hasFeatureSettings -%}
{%- if hasSupportedFeatures -%} {{- form_row(form.supportedFeatures, { 'formSettings': formSettings, 'formNotes': formNotes, }) -}} {%- endif -%} {%- if hasFeatureSettings -%} {{ form_row(form.featureSettings, { 'formSettings': formSettings, 'formNotes': formNotes, }) -}} {%- endif -%}
{%- endif -%} {%- if hasFields -%}

{{ fieldLabel|trans }}

{{- fieldHtml|raw -}}
{%- endif -%} {%- if hasCompanyFields -%}

{{ 'mautic.integration.companyfield_matches'|trans }}

{{- companyFieldHtml|raw -}}
{%- endif -%}
{{ form_end(form) }}