Fixed empty box names
authorMarcel Werk <burntime@woltlab.com>
Tue, 11 Oct 2016 22:15:00 +0000 (00:15 +0200)
committerMarcel Werk <burntime@woltlab.com>
Tue, 11 Oct 2016 22:15:05 +0000 (00:15 +0200)
wcfsetup/install/files/lib/acp/form/MenuAddForm.class.php
wcfsetup/install/files/lib/acp/form/MenuEditForm.class.php

index 0059cd05d0f83685d1be2beac535c3a4d80c24f4..d263dacc3f61179fe77b5455e56936c08224954e 100644 (file)
@@ -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,
index 7b88d133de1b0768eaa23049bbe84a5d42836723..2ce3e8b017b6d3d1cc3e3a33672a15a5a6f5c01c 100644 (file)
@@ -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();
                }