From 02046d6ec7f7db098042a42e129bfd73a75adce4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Joshua=20R=C3=BCsweg?= Date: Tue, 5 Feb 2019 12:33:21 +0100 Subject: [PATCH] Simplify ReactionType(Add|Edit)Form See #2825 --- .../acp/form/ReactionTypeAddForm.class.php | 21 +++++++------------ .../acp/form/ReactionTypeEditForm.class.php | 14 ------------- 2 files changed, 7 insertions(+), 28 deletions(-) diff --git a/wcfsetup/install/files/lib/acp/form/ReactionTypeAddForm.class.php b/wcfsetup/install/files/lib/acp/form/ReactionTypeAddForm.class.php index d5c2c2ff1c..a959953692 100644 --- a/wcfsetup/install/files/lib/acp/form/ReactionTypeAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/ReactionTypeAddForm.class.php @@ -46,11 +46,6 @@ class ReactionTypeAddForm extends AbstractFormBuilderForm { */ public $neededModules = ['MODULE_LIKE']; - /** - * @var UploadFormField - */ - protected $uploadFormField; - /** * @inheritDoc */ @@ -81,18 +76,16 @@ class ReactionTypeAddForm extends AbstractFormBuilderForm { ->label('wcf.acp.reactionType.isDisabled') ]); - $this->uploadFormField = UploadFormField::create('iconFile') - ->label('wcf.acp.reactionType.image') - ->description('wcf.acp.reactionType.image.description') - ->required() - ->maximum(1) - ->imageOnly(true) - ->allowSvgImage(true); - $iconContainer = FormContainer::create('imageSection') ->label('wcf.acp.reactionType.image') ->appendChildren([ - $this->uploadFormField + UploadFormField::create('iconFile') + ->label('wcf.acp.reactionType.image') + ->description('wcf.acp.reactionType.image.description') + ->required() + ->maximum(1) + ->imageOnly(true) + ->allowSvgImage(true) ]); $this->form->appendChildren([ diff --git a/wcfsetup/install/files/lib/acp/form/ReactionTypeEditForm.class.php b/wcfsetup/install/files/lib/acp/form/ReactionTypeEditForm.class.php index fae735ed65..af5f65af95 100644 --- a/wcfsetup/install/files/lib/acp/form/ReactionTypeEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/ReactionTypeEditForm.class.php @@ -2,7 +2,6 @@ namespace wcf\acp\form; use wcf\data\reaction\type\ReactionType; use wcf\system\exception\IllegalLinkException; -use wcf\system\file\upload\UploadFile; /** * Represents the reaction type add form. @@ -37,17 +36,4 @@ class ReactionTypeEditForm extends ReactionTypeAddForm { } } } - - /** - * Sets the form data based on the current form object. - */ - protected function setFormObjectData() { - parent::setFormObjectData(); - - if (empty($_POST)) { - $this->uploadFormField->value([ - new UploadFile(WCF_DIR . 'images/reaction/' . $this->formObject->iconFile, basename($this->formObject->iconFile), true, true, true) - ]); - } - } } -- 2.20.1