Skip to content

Commit 7bca315

Browse files
authored
Merge pull request #1589 from craftcms/bugfix/1585-tweaks
tweaks for 1585
2 parents 651cd15 + dee2658 commit 7bca315

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

src/fields/Categories.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ public static function getMatchFields(FeedModel $feed, ?BaseRelationField $field
253253
}
254254
// otherwise get the layout for the group selected in the field's settings
255255
return array_filter(
256-
FieldHelper::getElementLayoutByField($field::class, $field),
256+
FieldHelper::getElementLayoutByField($field::class, $field) ?? [],
257257
fn($field) => FieldHelper::fieldCanBeUniqueId($field)
258258
);
259259
}

src/fields/Entries.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,10 @@ public static function getMatchFields(FeedModel $feed, ?BaseRelationField $field
298298
}
299299

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

303306
if (!empty($customSources)) {
304307
$allowedFields = [...$allowedFields, ...Craft::$app->getFields()->getAllFields()];

src/fields/Users.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ public function parseField(): mixed
222222
*/
223223
public static function getMatchFields(FeedModel $feed, ?BaseRelationField $field = null): array
224224
{
225-
return array_filter(FieldHelper::getUserLayoutByField(), fn($field) => FieldHelper::fieldCanBeUniqueId($field));
225+
return array_filter(FieldHelper::getUserLayoutByField() ?? [], fn($field) => FieldHelper::fieldCanBeUniqueId($field));
226226
}
227227

228228
// Private Methods

0 commit comments

Comments
 (0)