{% import '_includes/forms' as forms %} {% import 'feed-me/_macros' as feedMeMacro %} {% if feed.elementGroup %} {% set sectionId = feed.elementGroup[feed.elementType].section %} {% set entryTypeId = feed.elementGroup[feed.elementType].entryType %} {% set section = craft.app.sections.getSectionById(sectionId) %} {% set entryType = craft.app.sections.getEntryTypeById(entryTypeId) %} {% endif %} {% set fields = [{ name: 'Title', handle: 'title', default: { type: 'text', }, }, { name: 'Slug', handle: 'slug', instructions: 'If not set, the Slug will be automatically created from Title.'|t('feed-me'), default: { type: 'text', }, }] %} {# If a structure, provide the option for a parent #} {% if section.type == 'structure' %} {% set fields = fields|push({ type: 'entries', name: 'Parent', handle: 'parent', instructions: 'Select a parent entry to import these entries under.'|t('feed-me'), default: { type: 'elementselect', options: { elementType: 'craft\\elements\\Entry', sources: ['section:' ~ section.uid], selectionLabel: "Default Parent"|t('feed-me'), limit: 1, }, }, }) %} {% endif %} {% set fields = fields|merge([{ type: 'date', name: 'Post Date', handle: 'postDate', instructions: 'Accepts Unix timestamp, or just about any English textual datetime description.'|t('feed-me'), default: { type: 'dateTime', }, }, { type: 'date', name: 'Expiry Date', handle: 'expiryDate', instructions: 'Accepts Unix timestamp, or just about any English textual datetime description.'|t('feed-me'), default: { type: 'dateTime', }, }, { name: 'Status', handle: 'enabled', instructions: 'Choose either a default status from the list or the imported field that will contain the status.'|t('feed-me'), default: { type: 'select', options: [ { label: 'Don’t import'|t('feed-me'), value: '' }, { label: 'Enabled', value: '1' }, { label: 'Disabled', value: '0' }, ], }, }]) %} {#{% if craft.app.isMultiSite() %} {% set fields = fields|merge([{ name: 'Locale Status', handle: 'localeEnabled', instructions: 'Choose whether this entry should be enabled for this locale. This settings is in addition to the overall Entry Status above.'|t('feed-me'), default: { type: 'select', options: [ { label: 'Don’t import'|t('feed-me'), value: '' }, { label: 'Enabled', value: '1' }, { label: 'Disabled', value: '0' }, ], }, }]) %} {% endif %}#} {% set fields = fields|push({ type: 'users', name: 'Author', handle: 'authorId', instructions: 'Entries will be assigned to the user in this field. If the field does not match any existing member, the default author will be assigned.'|t('feed-me'), default: { type: 'elementselect', options: { elementType: 'craft\\elements\\User', selectionLabel: "Default Author"|t('feed-me'), limit: 1, }, }, }) %} {% if not feed.singleton %} {% set fields = fields|push({ name: 'Entry ID', handle: 'id', instructions: 'Warning: This should only be used for an existing Craft Entry ID.'|t('feed-me'), default: { type: 'text', }, }) %} {% endif %}
{{ 'Field'|t('feed-me') }} | {{ 'Feed Element'|t('feed-me') }} | {{ 'Default Value'|t('feed-me') }} | {% for field in fields %} {% set template = field.type ?? 'default' %} {% set variables = field|merge({ feed: feed, feedData: feedData, attribute: true }) %} {% include 'feed-me/_includes/fields/' ~ template ignore missing with variables only %} {% endfor %}
---|
{{ 'Field'|t('feed-me') }} | {{ 'Feed Element'|t('feed-me') }} | {{ 'Default Value'|t('feed-me') }} | {% for layoutField in tab.getElements()|filter(e => e is instance of('craft\\fieldlayoutelements\\CustomField')) %} {% set field = layoutField.getField() %} {% set fieldClass = craft.feedme.fields.getRegisteredField(className(field)) %} {% set template = fieldClass.getMappingTemplate() %} {% set variables = { name: field.name, handle: field.handle, feed: feed, feedData: feedData, field: field, fieldClass: fieldClass } %} {% include template ignore missing with variables only %} {% endfor %}
---|
{{ "Select the fields you want to use to check for existing elements. When selected, Feed Me will look for existing elements that match the fields provided below and either update, or skip depending on your choice of Import Strategy."|t('feed-me') }}
{% for tab in tabs %} {% for layoutField in tab.getElements()|filter(e => e is instance of('craft\\fieldlayoutelements\\CustomField')) %} {% set field = layoutField.getField() %} {% set fields = fields|merge([{ name: field.name, handle: field.handle, type: className(field) }]) %} {% endfor %} {% endfor %} {% endif %}