From 1d2f2b1c36b0bf0ccb2d00008147a9eabd1c173b Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 26 Feb 2018 12:32:41 +0100 Subject: [PATCH] Reset the list of selected boxes to the default values --- .../files/lib/acp/form/PageAddForm.class.php | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/wcfsetup/install/files/lib/acp/form/PageAddForm.class.php b/wcfsetup/install/files/lib/acp/form/PageAddForm.class.php index 42f35c9b9a..e7c63558a9 100644 --- a/wcfsetup/install/files/lib/acp/form/PageAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/PageAddForm.class.php @@ -471,7 +471,8 @@ class PageAddForm extends AbstractForm { $this->parentPageID = $this->isDisabled = $this->isLandingPage = 0; $this->applicationPackageID = 1; $this->name = ''; - $this->customURL = $this->title = $this->content = $this->metaDescription = $this->metaKeywords = $this->boxIDs = $this->aclValues = []; + $this->customURL = $this->title = $this->content = $this->metaDescription = $this->metaKeywords = $this->aclValues = []; + $this->boxIDs = $this->getDefaultBoxIDs(); } /** @@ -482,10 +483,21 @@ class PageAddForm extends AbstractForm { // set default values if (empty($_POST)) { - foreach ($this->availableBoxes as $box) { - if ($box->visibleEverywhere) $this->boxIDs[] = $box->boxID; - } + $this->boxIDs = $this->getDefaultBoxIDs(); + } + } + + /** + * Returns the list of box ids that are enabled by default. + * + * @return integer[] + */ + protected function getDefaultBoxIDs() { + $boxIDs = []; + foreach ($this->availableBoxes as $box) { + if ($box->visibleEverywhere) $boxIDs[] = $box->boxID; } + return $boxIDs; } /** -- 2.20.1