Skip to content

Commit 28e819c

Browse files
committed
Save i18n values
1 parent cad3d60 commit 28e819c

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

wcfsetup/install/files/lib/data/contact/option/ContactOptionAction.class.php

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use wcf\data\AbstractDatabaseObjectAction;
66
use wcf\data\ISortableAction;
7+
use wcf\data\TI18nDatabaseObjectAction;
78
use wcf\system\exception\UserInputException;
89
use wcf\system\WCF;
910

@@ -19,6 +20,8 @@
1920
*/
2021
class ContactOptionAction extends AbstractDatabaseObjectAction implements ISortableAction
2122
{
23+
use TI18nDatabaseObjectAction;
24+
2225
/**
2326
* @inheritDoc
2427
*/
@@ -82,4 +85,55 @@ public function updatePosition()
8285
}
8386
WCF::getDB()->commitTransaction();
8487
}
88+
89+
#[\Override]
90+
public function create()
91+
{
92+
$option = parent::create();
93+
94+
$this->saveI18nValue($option);
95+
96+
return $option;
97+
}
98+
99+
#[\Override]
100+
public function delete()
101+
{
102+
$result = parent::delete();
103+
104+
$this->deleteI18nValues();
105+
106+
return $result;
107+
}
108+
109+
#[\Override]
110+
public function update()
111+
{
112+
parent::update();
113+
114+
foreach ($this->objects as $editor) {
115+
$this->saveI18nValue($editor->getDecoratedObject());
116+
}
117+
}
118+
119+
#[\Override]
120+
public function getI18nSaveTypes(): array
121+
{
122+
return [
123+
'optionTitle' => 'wcf.contact.option\d+',
124+
'optionDescription' => 'wcf.contact.optionDescription\d+',
125+
];
126+
}
127+
128+
#[\Override]
129+
public function getLanguageCategory(): string
130+
{
131+
return 'wcf.contact';
132+
}
133+
134+
#[\Override]
135+
public function getPackageID(): int
136+
{
137+
return 1;
138+
}
85139
}

0 commit comments

Comments
 (0)