Skip to content

Commit 71b4566

Browse files
committed
Save i18n values
1 parent 66727f6 commit 71b4566

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

wcfsetup/install/files/lib/data/trophy/TrophyAction.class.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use wcf\data\file\FileEditor;
77
use wcf\data\IToggleAction;
88
use wcf\data\TDatabaseObjectToggle;
9+
use wcf\data\TI18nDatabaseObjectAction;
910
use wcf\data\user\trophy\UserTrophyAction;
1011
use wcf\data\user\trophy\UserTrophyList;
1112
use wcf\data\user\UserAction;
@@ -27,6 +28,7 @@
2728
class TrophyAction extends AbstractDatabaseObjectAction implements IToggleAction
2829
{
2930
use TDatabaseObjectToggle;
31+
use TI18nDatabaseObjectAction;
3032

3133
/**
3234
* @inheritDoc
@@ -56,6 +58,8 @@ public function create()
5658

5759
$trophy = parent::create();
5860

61+
$this->saveI18nValue($trophy);
62+
5963
$trophyEditor = new TrophyEditor($trophy);
6064
$trophyEditor->setShowOrder($showOrder);
6165

@@ -99,6 +103,8 @@ public function delete()
99103

100104
$returnValues = parent::delete();
101105

106+
$this->deleteI18nValues();
107+
102108
UserStorageHandler::getInstance()->resetAll('specialTrophies');
103109

104110
return $returnValues;
@@ -114,6 +120,10 @@ public function update()
114120
if (\count($this->objects) == 1 && isset($this->parameters['data']['showOrder']) && $this->parameters['data']['showOrder'] != \reset($this->objects)->showOrder) {
115121
\reset($this->objects)->setShowOrder($this->parameters['data']['showOrder']);
116122
}
123+
124+
foreach ($this->objects as $object) {
125+
$this->saveI18nValue($object->getDecoratedObject());
126+
}
117127
}
118128

119129
/**
@@ -185,4 +195,25 @@ public function toggle()
185195

186196
UserStorageHandler::getInstance()->resetAll('specialTrophies');
187197
}
198+
199+
#[\Override]
200+
public function getI18nSaveTypes(): array
201+
{
202+
return [
203+
'title' => 'wcf.user.trophy.title\d+',
204+
'description' => 'wcf.user.trophy.description\d+',
205+
];
206+
}
207+
208+
#[\Override]
209+
public function getLanguageCategory(): string
210+
{
211+
return 'wcf.user.trophy';
212+
}
213+
214+
#[\Override]
215+
public function getPackageID(): int
216+
{
217+
return 1;
218+
}
188219
}

0 commit comments

Comments
 (0)