From 0bc375b2c68f235c971ed8a6ed170a1e56b0f601 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sun, 14 Apr 2019 17:08:41 +0200 Subject: [PATCH] Use AbstractFormBuilderForm for UserGroupPromoteOwnerForm See #2890 --- .../form/UserGroupPromoteOwnerForm.class.php | 51 ++++++------------- 1 file changed, 15 insertions(+), 36 deletions(-) diff --git a/wcfsetup/install/files/lib/acp/form/UserGroupPromoteOwnerForm.class.php b/wcfsetup/install/files/lib/acp/form/UserGroupPromoteOwnerForm.class.php index 365a3985ed..9ae2344294 100644 --- a/wcfsetup/install/files/lib/acp/form/UserGroupPromoteOwnerForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserGroupPromoteOwnerForm.class.php @@ -3,11 +3,10 @@ namespace wcf\acp\form; use wcf\data\user\group\UserGroup; use wcf\data\user\group\UserGroupAction; use wcf\form\AbstractForm; +use wcf\form\AbstractFormBuilderForm; use wcf\system\exception\IllegalLinkException; use wcf\system\form\builder\container\FormContainer; use wcf\system\form\builder\field\RadioButtonFormField; -use wcf\system\form\builder\FormDocument; -use wcf\system\form\builder\IFormDocument; use wcf\system\request\LinkHandler; use wcf\system\WCF; use wcf\util\HeaderUtil; @@ -21,17 +20,12 @@ use wcf\util\HeaderUtil; * @package WoltLabSuite\Core\Acp\Form * @since 5.2 */ -class UserGroupPromoteOwnerForm extends AbstractForm { +class UserGroupPromoteOwnerForm extends AbstractFormBuilderForm { /** * @inheritDoc */ public $activeMenuItem = 'wcf.acp.menu.link.group.list'; - /** - * @var IFormDocument - */ - public $form; - /** * @var UserGroup */ @@ -66,51 +60,37 @@ class UserGroupPromoteOwnerForm extends AbstractForm { uasort($this->groups, function(UserGroup $a, UserGroup $b) { return $a->getName() <=> $b->getName(); }); - - $this->form = FormDocument::create('promoteGroup') - ->appendChild( - FormContainer::create('groupSection') - ->appendChild( - RadioButtonFormField::create('groupID') - ->label('wcf.acp.group.promoteOwner.group') - ->required() - ->options($this->groups) - ) - ); - $this->form->action(LinkHandler::getInstance()->getLink('UserGroupPromoteOwner')); - $this->form->build(); - } - - /** - * @inheritDoc - */ - public function readFormParameters() { - parent::readFormParameters(); - - $this->form->readValues(); } /** * @inheritDoc */ - public function validate() { - parent::validate(); + protected function createForm() { + parent::createForm(); - $this->form->validate(); + $this->form->appendChild( + FormContainer::create('groupSection') + ->appendChild( + RadioButtonFormField::create('groupID') + ->label('wcf.acp.group.promoteOwner.group') + ->required() + ->options($this->groups) + ) + ); } /** * @inheritDoc */ public function save() { - parent::save(); + AbstractForm::save(); $groupID = $this->form->getData()['data']['groupID']; $this->objectAction = new UserGroupAction([$this->groups[$groupID]], 'promoteOwner'); $this->objectAction->executeAction(); - $this->saved(); + AbstractForm::saved(); HeaderUtil::redirect(LinkHandler::getInstance()->getLink()); exit; @@ -123,7 +103,6 @@ class UserGroupPromoteOwnerForm extends AbstractForm { parent::assignVariables(); WCF::getTPL()->assign([ - 'form' => $this->form, // Hide the notice on this page only. '__wscMissingOwnerGroup' => false, ]); -- 2.20.1