{% set static = static is defined ? static : false %} {% set element = element is defined ? element : null %} {% set value = (element ? element.getFieldValue(field.handle) : field.normalizeValue(null)) %} {% set errors = (element and not static ? element.getErrors(field.handle) : null) %} {% set instructions = (not static and field.instructions ? field.instructions|t('site') : null) %} {% set translatable = field.getIsTranslatable(element) %} {% set siteId = (translatable and (element.isLocalized() ?? true)) ? (siteId ?? element.siteId ?? craft.app.sites.currentSite.id) %} {% if translatable %} {% switch field.translationMethod %} {% case 'site' %} {% set translationDescription = 'This field is translated for each site.'|t('app') %} {% case 'siteGroup' %} {% set translationDescription = 'This field is translated for each site group.'|t('app') %} {% case 'language' %} {% set translationDescription = 'This field is translated for each language.'|t('app') %} {% endswitch %} {% endif %} {% if not static %} {# Special-case for Matrix-in-SuperTable #} {% if field.displayName() == 'Matrix' %} {% set input = craft.superTable.getMatrixInputHtml(field, value, element) %} {% else %} {% set input = field.getInputHtml(value, element) %} {% endif %} {% else %} {% set input = field.getStaticHtml(value, element) %} {% endif %} {% if instructions or input %} {% embed "_includes/forms/field" with { label: field.name|t('site')|e, translatable: translatable, translationDescription: translationDescription ?? null, siteId: siteId, required: (not static ? required : false), instructions: instructions|e, id: field.handle, errors: errors, input: input, fieldType: className(field), } only %} {% block attr %}data-type="{{ fieldType }}"{% endblock %} {% endembed %} {% endif %}