Repository: pimcore/pimcore (language: php)

Issue:
[Bug]: New Values for Selected Options not showing when custom layouts.
### Pimcore version

11

### Steps to reproduce

1. Introduce some values within a selected option field.
2. Create a custom layout.
3. Then add new values to the selected option field.

This new values do not appear when using the drop down for the selected option field on the custom layout

### Actual Behavior

possible values within selected options are not being updated when using it via a custom layout

### Expected Behavior

i think it could be nice to also trigger some update on the possible values for the selected field within the custom layouts


Discussion / hints:
Thanks a lot for reporting the issue. We did not consider the issue as "Pimcore:Priority", "Pimcore:ToDo" or "Pimcore:Backlog", so we're not going to work on that anytime soon. Please create a pull request to fix the issue if this is a bug report. We'll then review it as quickly as possible. If you're interested in contributing a feature, please contact us first here before creating a pull request. We'll then decide whether we'd accept it or not. Thanks for your understanding.

Fix patch:
diff --git a/models/DataObject/ClassDefinition.php b/models/DataObject/ClassDefinition.php
index f4197fa93a2..0588a768393 100644
--- a/models/DataObject/ClassDefinition.php
+++ b/models/DataObject/ClassDefinition.php
@@ -404,8 +404,11 @@ public function save(bool $saveDefinitionFile = true): void
         } else {
             $this->dispatchEvent(new ClassDefinitionEvent($this), DataObjectClassDefinitionEvents::POST_ADD);
         }
-
-        $this->deleteDeletedDataComponentsInCustomLayout();
+        if (!empty($this->getDeletedDataComponents())) {
+            $this->deleteDeletedDataComponentsInCustomLayout();
+        } else {
+            $this->updateCustomLayouts();
+        }
     }
 
     /**
@@ -1138,11 +1141,23 @@ public function setDeletedDataComponents(array $deletedDataComponents): ClassDef
         return $this;
     }
 
-    private function deleteDeletedDataComponentsInCustomLayout(): void
+    private function updateCustomLayouts(): void
     {
-        if (empty($this->getDeletedDataComponents())) {
-            return;
+
+        $customLayouts = new ClassDefinition\CustomLayout\Listing();
+        $id = $this->getId();
+        $customLayouts->setFilter(function (DataObject\ClassDefinition\CustomLayout $layout) use ($id) {
+            return $layout->getClassId() === $id;
+        });
+        $customLayouts = $customLayouts->load();
+
+        foreach ($customLayouts as $customLayout) {
+            $customLayout->save();
         }
+    }
+
+    private function deleteDeletedDataComponentsInCustomLayout(): void
+    {
         $customLayouts = new ClassDefinition\CustomLayout\Listing();
         $id = $this->getId();
         $customLayouts->setFilter(function (DataObject\ClassDefinition\CustomLayout $layout) use ($id) {


Test patch: