From: Joshua Rüsweg Date: Tue, 5 Feb 2019 11:33:21 +0000 (+0100) Subject: Simplify ReactionType(Add|Edit)Form X-Git-Tag: 5.2.0_Alpha_1~296^2~2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=02046d6ec7f7db098042a42e129bfd73a75adce4;p=GitHub%2FWoltLab%2FWCF.git Simplify ReactionType(Add|Edit)Form See #2825 --- 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) - ]); - } - } }