From 2dd2e0fe49af219ba80ff8ed754ee70734eeba41 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Wed, 12 Oct 2016 00:15:00 +0200 Subject: [PATCH] Fixed empty box names --- .../install/files/lib/acp/form/MenuAddForm.class.php | 9 ++++++++- .../files/lib/acp/form/MenuEditForm.class.php | 12 ++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/wcfsetup/install/files/lib/acp/form/MenuAddForm.class.php b/wcfsetup/install/files/lib/acp/form/MenuAddForm.class.php index 0059cd05d0..d263dacc3f 100644 --- a/wcfsetup/install/files/lib/acp/form/MenuAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/MenuAddForm.class.php @@ -8,6 +8,7 @@ use wcf\form\AbstractForm; use wcf\system\database\util\PreparedStatementConditionBuilder; use wcf\system\exception\UserInputException; use wcf\system\language\I18nHandler; +use wcf\system\language\LanguageFactory; use wcf\system\WCF; use wcf\util\ArrayUtil; use wcf\util\StringUtil; @@ -151,13 +152,19 @@ class MenuAddForm extends AbstractForm { public function save() { parent::save(); + $boxName = $this->title; + if (!I18nHandler::getInstance()->isPlainValue('title')) { + $values = I18nHandler::getInstance()->getValues('title'); + $boxName = $values[LanguageFactory::getInstance()->getDefaultLanguageID()]; + } + // save label $this->objectAction = new MenuAction([], 'create', ['data' => array_merge($this->additionalFields, [ 'title' => $this->title, 'packageID' => 1, 'identifier' => '' ]), 'boxData' => [ - 'name' => $this->title, + 'name' => $boxName, 'boxType' => 'menu', 'position' => $this->position, 'visibleEverywhere' => $this->visibleEverywhere ? 1 : 0, diff --git a/wcfsetup/install/files/lib/acp/form/MenuEditForm.class.php b/wcfsetup/install/files/lib/acp/form/MenuEditForm.class.php index 7b88d133de..2ce3e8b017 100644 --- a/wcfsetup/install/files/lib/acp/form/MenuEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/MenuEditForm.class.php @@ -6,6 +6,7 @@ use wcf\data\menu\MenuAction; use wcf\form\AbstractForm; use wcf\system\exception\IllegalLinkException; use wcf\system\language\I18nHandler; +use wcf\system\language\LanguageFactory; use wcf\system\WCF; /** @@ -62,7 +63,13 @@ class MenuEditForm extends MenuAddForm { */ public function save() { AbstractForm::save(); - + + $boxName = $this->title; + if (!I18nHandler::getInstance()->isPlainValue('title')) { + $values = I18nHandler::getInstance()->getValues('title'); + $boxName = $values[LanguageFactory::getInstance()->getDefaultLanguageID()]; + } + $this->title = 'wcf.menu.menu'.$this->menu->menuID; if (I18nHandler::getInstance()->isPlainValue('title')) { I18nHandler::getInstance()->remove($this->title); @@ -85,7 +92,8 @@ class MenuEditForm extends MenuAddForm { 'visibleEverywhere' => $this->visibleEverywhere ? 1 : 0, 'showHeader' => $this->showHeader ? 1 : 0, 'showOrder' => $this->showOrder, - 'cssClassName' => $this->cssClassName + 'cssClassName' => $this->cssClassName, + 'name' => $boxName ]), 'pageIDs' => $this->pageIDs]); $boxAction->executeAction(); } -- 2.20.1