From 687b5e7972e88f2224d0c9440a691f74795ac4b0 Mon Sep 17 00:00:00 2001 From: Cyperghost Date: Mon, 18 Nov 2024 14:49:36 +0100 Subject: [PATCH] Set `parentCategoryName` in `save()` --- .../acp/form/UserOptionCategoryAddForm.class.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/wcfsetup/install/files/lib/acp/form/UserOptionCategoryAddForm.class.php b/wcfsetup/install/files/lib/acp/form/UserOptionCategoryAddForm.class.php index 568ce03d27..043e583244 100644 --- a/wcfsetup/install/files/lib/acp/form/UserOptionCategoryAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserOptionCategoryAddForm.class.php @@ -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() { -- 2.20.1