From: Matthias Schmidt Date: Mon, 22 Aug 2016 15:57:08 +0000 (+0200) Subject: Fix determination of box name during installation X-Git-Tag: 3.0.0_Beta_1~576^2~5 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1bfc18bcb632c74fcc9851996b40ad29ffb42455;p=GitHub%2FWoltLab%2FWCF.git Fix determination of box name during installation Use same code as for pages --- 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 7cfd9dedca..6939388536 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/BoxPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/BoxPackageInstallationPlugin.class.php @@ -128,6 +128,21 @@ class BoxPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin throw new SystemException("Unknown box position '{$position}' for box '{$identifier}'"); } + // pick the display name by choosing the default language, or 'en' or '' (empty string) + $defaultLanguageCode = LanguageFactory::getInstance()->getDefaultLanguage()->getFixedLanguageCode(); + if (isset($data['elements']['name'][$defaultLanguageCode])) { + // use the default language + $name = $data['elements']['name'][$defaultLanguageCode]; + } + else if (isset($data['elements']['name']['en'])) { + // use the value for English + $name = $data['elements']['name']['en']; + } + else { + // fallback to the display name without/empty language attribute + $name = $data['elements']['name']['']; + } + $ignoreMissingContent = false; switch ($boxType) { /** @noinspection PhpMissingBreakStatementInspection */ @@ -200,7 +215,7 @@ class BoxPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin return [ 'identifier' => $identifier, 'content' => $content, - 'name' => $this->getI18nValues($data['elements']['name'], true), + 'name' => $name, 'boxType' => $boxType, 'position' => $position, 'showOrder' => $this->getItemOrder($position),