From b5d9696172c17080e643215494a233538885c44e Mon Sep 17 00:00:00 2001 From: i-just Date: Fri, 10 Oct 2025 15:17:02 +0100 Subject: [PATCH] ensure that the custom field's field exists before adding it to the tab's elements --- src/models/FieldLayoutTab.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/models/FieldLayoutTab.php b/src/models/FieldLayoutTab.php index d9d8a90a200..d6d900e8e17 100644 --- a/src/models/FieldLayoutTab.php +++ b/src/models/FieldLayoutTab.php @@ -281,6 +281,12 @@ public function setElements(array $elements): void if (is_array($layoutElement)) { try { $layoutElement = $fieldsService->createLayoutElement($layoutElement); + if ($layoutElement instanceof CustomField) { + // check if the underlying field exists + // if not, it should be caught by FieldNotFoundException + // and not added to the tab's elements + $field = $layoutElement->getField(); + } } catch (FieldNotFoundException) { // Skip quietly continue;