-
Notifications
You must be signed in to change notification settings - Fork 148
Expand file tree
/
Copy pathLanguageInteractions.class.php
More file actions
52 lines (47 loc) · 1.62 KB
/
LanguageInteractions.class.php
File metadata and controls
52 lines (47 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
namespace wcf\system\interaction\admin;
use wcf\acp\form\LanguageExportForm;
use wcf\data\language\Language;
use wcf\event\interaction\admin\LanguageInteractionCollecting;
use wcf\system\event\EventHandler;
use wcf\system\interaction\AbstractInteractionProvider;
use wcf\system\interaction\DeleteInteraction;
use wcf\system\interaction\InteractionEffect;
use wcf\system\interaction\LinkInteraction;
use wcf\system\interaction\RpcInteraction;
/**
* Interaction provider for languages.
*
* @author Olaf Braun
* @copyright 2001-2025 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @since 6.2
*/
final class LanguageInteractions extends AbstractInteractionProvider
{
public function __construct()
{
$this->addInteractions([
new LinkInteraction("export", LanguageExportForm::class, "wcf.acp.language.export"),
new RpcInteraction(
"setAsDefault",
"core/languages/%s/default",
"wcf.acp.language.setAsDefault",
isAvailableCallback: static fn(Language $language) => !$language->isDefault,
interactionEffect: InteractionEffect::ReloadList
),
new DeleteInteraction(
"core/languages/%s",
static fn(Language $language) => $language->isDeletable()
)
]);
EventHandler::getInstance()->fire(
new LanguageInteractionCollecting($this)
);
}
#[\Override]
public function getObjectClassName(): string
{
return Language::class;
}
}