Fix adding reactions with multilingual title fields
authorJoshua Rüsweg <ruesweg@woltlab.com>
Fri, 10 Jan 2020 19:24:30 +0000 (20:24 +0100)
committerJoshua Rüsweg <ruesweg@woltlab.com>
Fri, 10 Jan 2020 19:24:35 +0000 (20:24 +0100)
wcfsetup/install/files/lib/data/reaction/type/ReactionTypeAction.class.php

index 2317ee042a8eeb8b56abef201380cbcabc7831c2..ee73d23b61fa7473984211c98db577439050adc9 100644 (file)
@@ -54,6 +54,12 @@ class ReactionTypeAction extends AbstractDatabaseObjectAction implements ISortab
                        ]);
                }
                
+               // The title cannot be empty by design, but cannot be filled proper if the
+               // multilingualism is enabled, therefore, we must fill the tilte with a dummy value.
+               if (!isset($this->parameters['data']['title']) && isset($this->parameters['title_i18n'])) {
+                       $this->parameters['data']['title'] = 'wcf.reactionType.title';
+               }
+               
                /** @var ReactionType $reactionType */
                $reactionType = parent::create();
                $reactionTypeEditor = new ReactionTypeEditor($reactionType);