Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/1572 relation field elements matching #1585

Merged
merged 7 commits into from
Feb 6, 2025

Conversation

i-just
Copy link
Contributor

@i-just i-just commented Feb 5, 2025

Description

When mapping relation fields, for some relation field types, you can choose to map them not only via a predefined list of attributes but also some of the custom fields.

Historically, the list of available match options was a list of all the fields (not just ones that are related to the sections/category group, etc., that are used by the relation field) that were deemed fit to be used as a unique identifier (a selection of the “simple” fields).

With the changes in Craft 5, that has become less intuitive to use.

This PR changes this behaviour so that:

  • for the Users field and Author attribute
    • only list the custom fields from the user field layout (there’s only one);
  • for the Entries field
    • only list the custom fields from the field layouts attached to the sources used by the field;
    • if only custom sources are selected by the Entries field, show all the custom fields;
    • if there’s a mixture of custom and native sources, list the custom fields from the field layouts attached to the sources used by the field, followed by a list of all the custom fields;
  • for the Categories field
    • only list the custom fields from the field layout attached to the category group used by the field;
    • if a custom source is selected for the Categories field, show all the custom fields
  • for the Parent attribute for Entries and Categories (when they’re hierarchical)
    • only list the custom fields from the layout linked to the entry type or category group selected when defining the feed

To be clear, in all the above cases, the list of fields is further filtered down to only the ones that can be used as a unique identifier.

Related issues

#1572

@i-just i-just requested a review from angrybrad as a code owner February 5, 2025 14:50
@angrybrad angrybrad merged commit a72066e into 6.x Feb 6, 2025
4 checks passed
@angrybrad angrybrad deleted the feature/1572-relation-field-elements-matching branch February 6, 2025 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants