{# ------------------------ #} {# Available Variables #} {# ------------------------ #} {# Attributes: #} {# type, name, handle, instructions, attribute, default, feed, feedData #} {# ------------------------ #} {# Fields: #} {# name, handle, instructions, feed, feedData, field, fieldClass #} {# ------------------------ #} {% import 'feed-me/_macros' as feedMeMacro %} {% import '_includes/forms' as forms %} {% if field is defined %} {% set default = default ?? { type: 'elementselect', options: { elementType: fieldClass.elementType, selectionLabel: "Default User"|t('feed-me'), sources: field.sources ?? '*', }, } %} {% endif %} {# Get any sub-fields for the element. Also check to go only one level deep #} {% if field is defined and isSubElementField is not defined %} {% set elementFields = [] %} {# Prevent infinite loop by only allow elements that are not the same as this #} {% for elementField in craft.feedme.getUserLayoutByField() %} {% if craft.feedme.supportedSubField(className(elementField)) %} {% set elementFields = elementFields|merge([ elementField ]) %} {% endif %} {% endfor %} {% endif %} {% extends 'feed-me/_includes/fields/_base' %} {% block extraSettings %}
{{ 'Data provided for this user is:'|t('feed-me') }} {% set matchAttributes = [ { value: 'email', label: 'Email'|t('feed-me') }, { value: 'elements.id', label: 'ID'|t('feed-me') }, { value: 'username', label: 'Username'|t('feed-me') }, { value: 'fullName', label: 'Full Name'|t('feed-me') }, ] %} {% for field in craft.app.fields.getAllFields() %} {% if craft.feedme.fieldCanBeUniqueId(field) %} {# Check for columnSuffix (since 3.7) #} {% set suffix = field['columnSuffix'] is defined and field.columnSuffix|length ? '_' ~ field.columnSuffix : '' %} {% set matchAttributes = matchAttributes|merge({ ('field_' ~ field.handle ~ suffix): field.name }) %} {% endif %} {% endfor %} {{ forms.selectField({ name: 'options[match]', class: 'users-field-match', value: hash_get(feed.fieldMapping, optionsPath ~ '.match') ?: '', options: matchAttributes, }) }}
{{ feedMeMacro.checkbox({ label: 'Create users if they do not exist'|t('feed-me'), name: 'options[create]', value: 1, checked: hash_get(feed.fieldMapping, optionsPath ~ '.create') ?: '', }) }}
{% endblock %}