Don't break when creating a field with definition inconsistencies

This commit is contained in:
Ivo Valchev
2021-03-03 10:28:48 +01:00
parent 01a4aea6e0
commit 993f68d543
+8
View File
@@ -66,6 +66,14 @@ class FieldType extends Collection
$definition = $contentType;
foreach ($parents as $parent) {
// This was here before due to extensions adding "services" as parent.
// But also, it prevents breakage when there's inconsistencies between
// the database and the definition. ¯\_(ツ)_/¯
if (! $definition->get('fields')) {
continue;
}
$definition = $definition->get('fields')->get($parent, collect([]));
}