Set `parentCategoryName` in `save()` 6.2-formbuilder-user-option
authorCyperghost <olaf_schmitz_1@t-online.de>
Mon, 18 Nov 2024 13:49:36 +0000 (14:49 +0100)
committerCyperghost <olaf_schmitz_1@t-online.de>
Mon, 18 Nov 2024 13:49:36 +0000 (14:49 +0100)
wcfsetup/install/files/lib/acp/form/UserOptionCategoryAddForm.class.php

index 568ce03d27a5fc83164d32407050d69cb0cb0331..043e58324420cc95fb926cf00cc300944cff1e6e 100644 (file)
@@ -46,11 +46,6 @@ class UserOptionCategoryAddForm extends AbstractFormBuilderForm
      */
     public $objectEditLinkController = UserOptionCategoryEditForm::class;
 
-    /**
-     * @inheritDoc
-     */
-    public $additionalFields = ['parentCategoryName' => 'profile'];
-
     #[\Override]
     protected function createForm()
     {
@@ -102,6 +97,16 @@ class UserOptionCategoryAddForm extends AbstractFormBuilderForm
             );
     }
 
+    #[\Override]
+    public function save()
+    {
+        if ($this->formAction === 'create') {
+            $this->additionalFields['parentCategoryName'] = 'profile';
+        }
+
+        parent::save();
+    }
+
     #[\Override]
     public function saved()
     {