From: Matthias Schmidt Date: Sat, 13 Oct 2018 08:40:10 +0000 (+0200) Subject: Fix issues with abstract option PIP GUI support X-Git-Tag: 5.2.0_Alpha_1~660 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a0a095ba39c824c95a2dd0b4c88e66a7ff783a84;p=GitHub%2FWoltLab%2FWCF.git Fix issues with abstract option PIP GUI support See #2545 --- diff --git a/wcfsetup/install/files/lib/system/package/plugin/AbstractOptionPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/AbstractOptionPackageInstallationPlugin.class.php index 7c8bdb6cb5..e8809f8522 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/AbstractOptionPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/AbstractOptionPackageInstallationPlugin.class.php @@ -383,11 +383,13 @@ abstract class AbstractOptionPackageInstallationPlugin extends AbstractXMLPackag case 'categories': $dataContainer->appendChildren([ TextFormField::create('categoryName') + ->objectProperty('name') ->label('wcf.acp.pip.abstractOption.categories.categoryName') ->description('wcf.acp.pip.' . $this->tagName . '.categories.categoryName.description') ->required(), SingleSelectionFormField::create('parentCategoryName') + ->objectProperty('parent') ->label('wcf.acp.pip.abstractOption.categories.parentCategoryName') ->options(function() { $categories = $this->getSortedCategories(); @@ -423,6 +425,7 @@ abstract class AbstractOptionPackageInstallationPlugin extends AbstractXMLPackag }, true), IntegerFormField::create('showOrder') + ->objectProperty('showorder') ->label('wcf.acp.pip.abstractOption.categories.showOrder') ->description('wcf.acp.pip.abstractOption.categories.showOrder.description') ->nullable(), @@ -771,38 +774,36 @@ abstract class AbstractOptionPackageInstallationPlugin extends AbstractXMLPackag } } + if ($saveData) { + $lowercaseData = [ + 'packageID' => $this->installation->getPackage()->packageID + ]; + + $lowercaseFields = [ + 'categoryName', + 'optionName', + 'optionType', + 'defaultValue', + 'enableOptions', + 'validationPattern', + 'showOrder' + ]; + + foreach ($lowercaseFields as $name) { + if (isset($data[$name])) { + $lowercaseData[strtolower($name)] = $data[$name]; + } + } + + return $lowercaseData; + } + break; default: throw new \LogicException('Unreachable'); } - if ($saveData) { - $lowercaseData = [ - 'packageID' => $this->installation->getPackage()->packageID - ]; - - $lowercaseFields = [ - 'categoryName', - 'optionName', - 'optionType', - 'defaultValue', - 'enableOptions', - 'validationPattern', - 'showOrder', - 'parentCategoryName', - 'showOrder' - ]; - - foreach ($lowercaseFields as $name) { - if (isset($data[$name])) { - $lowercaseData[strtolower($name)] = $data[$name]; - } - } - - return $lowercaseData; - } - return $data; } @@ -1023,6 +1024,7 @@ abstract class AbstractOptionPackageInstallationPlugin extends AbstractXMLPackag switch ($this->entryType) { case 'categories': $category = $document->createElement('category'); + $category->setAttribute('name', $formData['name']); $document->getElementsByTagName('import')->item(0)->appendChild($category);