Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/fields/Categories.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,15 @@ public static function getMatchFields(FeedModel $feed, ?BaseRelationField $field
return FieldHelper::getAllUniqueIdFields();
}
// otherwise get the layout for the group selected in the field's settings
return array_filter(
FieldHelper::getElementLayoutByField($field::class, $field) ?? [],
fn($field) => FieldHelper::fieldCanBeUniqueId($field)
);
$group = FieldHelper::getCategorySourcesByField($field);
if (!$group) {
return FieldHelper::getAllUniqueIdFields();
}

$fieldLayout = Craft::$app->getFields()->getLayoutById($group->fieldLayoutId);
$allowedFields = $fieldLayout?->getCustomFields() ?? [];

return array_filter($allowedFields, fn($field) => FieldHelper::fieldCanBeUniqueId($field));
}
}

Expand Down
Loading