Fix issues with abstract option PIP GUI support
authorMatthias Schmidt <gravatronics@live.com>
Sat, 13 Oct 2018 08:40:10 +0000 (10:40 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sat, 13 Oct 2018 08:40:10 +0000 (10:40 +0200)
See #2545

wcfsetup/install/files/lib/system/package/plugin/AbstractOptionPackageInstallationPlugin.class.php

index 7c8bdb6cb57b7e81e28917fcd0b00d56728afca2..e8809f85229164bb24467eca0884084060561e30 100644 (file)
@@ -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);