{%- set fieldset = fieldset ?? false %} {%- set id = id ?? "field#{random()}" %} {%- set fieldId = fieldId ?? "#{id}-field" %} {%- set labelId = labelId ?? "#{id}-#{fieldset ? 'legend' : 'label'}" %} {%- set instructionsId = instructionsId ?? "#{id}-instructions" %} {%- set status = status ?? null %} {%- set label = fieldLabel ?? label ?? block('label') ?? null %} {%- if label == '__blank__' %} {%- set label = null %} {%- endif %} {%- set siteId = craft.app.getIsMultiSite() ? (siteId ?? null) : null %} {%- set site = siteId ? craft.app.sites.getSiteById(siteId) : null %} {%- set required = required ?? false %} {%- set instructions = instructions ?? block('instructions') ?? null %} {%- set instructionsPosition = instructionsPosition ?? 'before' %} {%- set tip = tip ?? block('tip') ?? null %} {%- set warning = warning ?? block('warning') ?? null %} {%- set orientation = orientation ?? (site ? site.getLocale() : craft.app.locale).getOrientation() %} {%- set translatable = translatable ?? (site is not same as(null)) %} {%- set errors = errors ?? null -%} {%- set fieldClass = (fieldClass ?? [])|explodeClass|merge([ 'field', (first ?? false) ? 'first' : null, errors ? 'has-errors' : null, ])|filter %} {%- set showAttribute = (attribute ?? false) and (currentUser.admin ?? false) and currentUser.getPreference('showFieldHandles') %} {%- set fieldAttributes = { class: fieldClass, id: fieldId, }|merge(fieldAttributes ?? [], recursive=true) %} {%- if block('attr') is defined %} {%- set fieldAttributes = fieldAttributes|merge(('