From: Matthias Schmidt Date: Sun, 14 Oct 2018 08:49:59 +0000 (+0200) Subject: Fix default value handling in box PIP entry creation X-Git-Tag: 5.2.0_Alpha_1~637 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=454a855223770e1b1488f176a1b2b542190296da;p=GitHub%2FWoltLab%2FWCF.git Fix default value handling in box PIP entry creation … and sort visibility exceptions by name in the XML file. See #2545 --- diff --git a/wcfsetup/install/files/lib/system/package/plugin/BoxPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/BoxPackageInstallationPlugin.class.php index ea0a2d136f..c9c1372727 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/BoxPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/BoxPackageInstallationPlugin.class.php @@ -801,8 +801,7 @@ class BoxPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin $optionals = [ 'objectType' => '', 'cssClassName' => '', - 'showHeader' => 1, - 'visibleEverywhere' => 1 + 'showHeader' => 0 ]; foreach ($optionals as $field => $defaultValue) { if (isset($data[$field]) && $data[$field] !== $defaultValue) { @@ -811,14 +810,20 @@ class BoxPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin } if (!empty($data['visibilityExceptions'])) { + $box->appendChild($document->createElement('visibleEverywhere', (string)($data['visibleEverywhere'] ?? 0))); + $visibilityExceptions = $document->createElement('visibilityExceptions'); + sort($data['visibilityExceptions']); foreach ($data['visibilityExceptions'] as $page) { $visibilityExceptions->appendChild($document->createElement('page', $page)); } $box->appendChild($visibilityExceptions); } + else if (!empty($data['visibleEverywhere'])) { + $box->appendChild($document->createElement('visibleEverywhere', (string)$data['visibleEverywhere'])); + } foreach (LanguageFactory::getInstance()->getLanguages() as $language) { $content = null;