Skip to content

Commit

Permalink
Merge pull request #1589 from craftcms/bugfix/1585-tweaks
Browse files Browse the repository at this point in the history
tweaks for 1585
  • Loading branch information
angrybrad authored Feb 6, 2025
2 parents 651cd15 + dee2658 commit 7bca315
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/fields/Categories.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public static function getMatchFields(FeedModel $feed, ?BaseRelationField $field
}
// otherwise get the layout for the group selected in the field's settings
return array_filter(
FieldHelper::getElementLayoutByField($field::class, $field),
FieldHelper::getElementLayoutByField($field::class, $field) ?? [],
fn($field) => FieldHelper::fieldCanBeUniqueId($field)
);
}
Expand Down
5 changes: 4 additions & 1 deletion src/fields/Entries.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,10 @@ public static function getMatchFields(FeedModel $feed, ?BaseRelationField $field
}

// if there's a custom source in the mix, we should add all the fields too
$customSources = array_filter($field['sources'], (fn(string $source) => str_starts_with($source, 'custom:')));
$customSources = [];
if (is_array($field['sources'])) {
$customSources = array_filter($field['sources'], (fn(string $source) => str_starts_with($source, 'custom:')));
}

if (!empty($customSources)) {
$allowedFields = [...$allowedFields, ...Craft::$app->getFields()->getAllFields()];
Expand Down
2 changes: 1 addition & 1 deletion src/fields/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public function parseField(): mixed
*/
public static function getMatchFields(FeedModel $feed, ?BaseRelationField $field = null): array
{
return array_filter(FieldHelper::getUserLayoutByField(), fn($field) => FieldHelper::fieldCanBeUniqueId($field));
return array_filter(FieldHelper::getUserLayoutByField() ?? [], fn($field) => FieldHelper::fieldCanBeUniqueId($field));
}

// Private Methods
Expand Down

0 comments on commit 7bca315

Please sign in to comment.