forked from phacility/phabricator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPhabricatorDarkConsoleSetting.php
58 lines (45 loc) · 1.49 KB
/
PhabricatorDarkConsoleSetting.php
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
53
54
55
56
57
58
<?php
final class PhabricatorDarkConsoleSetting
extends PhabricatorSelectSetting {
const SETTINGKEY = 'dark_console';
const VALUE_DARKCONSOLE_DISABLED = '0';
const VALUE_DARKCONSOLE_ENABLED = '1';
public function getSettingName() {
return pht('DarkConsole');
}
public function getSettingPanelKey() {
return PhabricatorDeveloperPreferencesSettingsPanel::PANELKEY;
}
protected function getSettingOrder() {
return 100;
}
protected function isEnabledForViewer(PhabricatorUser $viewer) {
return PhabricatorEnv::getEnvConfig('darkconsole.enabled');
}
protected function getControlInstructions() {
return pht(
'DarkConsole is a debugging console for developing and troubleshooting '.
'Phabricator applications. After enabling DarkConsole, press the '.
'{nav `} key on your keyboard to toggle it on or off.');
}
public function getSettingDefaultValue() {
return self::VALUE_DARKCONSOLE_DISABLED;
}
protected function getSelectOptions() {
return array(
self::VALUE_DARKCONSOLE_DISABLED => pht('Disable DarkConsole'),
self::VALUE_DARKCONSOLE_ENABLED => pht('Enable DarkConsole'),
);
}
public function expandSettingTransaction($object, $xaction) {
// If the user has hidden the DarkConsole UI, forget their setting when
// they enable or disable it.
return array(
$xaction,
$this->newSettingTransaction(
$object,
PhabricatorDarkConsoleVisibleSetting::SETTINGKEY,
1),
);
}
}