Skip to content

Commit 6bd8ddf

Browse files
committed
don't freak out if there's no layout
1 parent 6b15f09 commit 6bd8ddf

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/fields/Entries.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,11 @@ public static function getMatchFields(FeedModel $feed, ?BaseRelationField $field
268268
return FieldHelper::getAllUniqueIdFields();
269269
}
270270

271-
$fieldLayout = Craft::$app->getFields()->getLayoutById($entryType->fieldLayoutId);
271+
$fieldLayout = null;
272+
if ($entryType->fieldLayoutId) {
273+
$fieldLayout = Craft::$app->getFields()->getLayoutById($entryType->fieldLayoutId);
274+
}
275+
272276
if (!$fieldLayout) {
273277
return FieldHelper::getAllUniqueIdFields();
274278
}
@@ -294,8 +298,12 @@ public static function getMatchFields(FeedModel $feed, ?BaseRelationField $field
294298
$entryTypes = Collection::make($entryTypes)->keyBy('id');
295299

296300
foreach ($entryTypes as $entryType) {
297-
$fieldLayout = Craft::$app->getFields()->getLayoutById($entryType->fieldLayoutId);
298-
$allowedFields = [...$allowedFields, ...$fieldLayout->getCustomFields()];
301+
if ($entryType->fieldLayoutId) {
302+
$fieldLayout = Craft::$app->getFields()->getLayoutById($entryType->fieldLayoutId);
303+
if ($fieldLayout) {
304+
$allowedFields = [...$allowedFields, ...$fieldLayout->getCustomFields()];
305+
}
306+
}
299307
}
300308

301309
// if there's a custom source in the mix, we should add all the fields too

0 commit comments

Comments
 (0)