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;
* @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
*/
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;
parent::assignVariables();
WCF::getTPL()->assign([
- 'form' => $this->form,
// Hide the notice on this page only.
'__wscMissingOwnerGroup' => false,
]);