forked from Zeichen32/PiwikCustomOptOut
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Settings.php
81 lines (66 loc) · 2.01 KB
/
Settings.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Plugins\CustomOptOut;
use Piwik\Piwik;
use Piwik\Settings\SystemSetting;
use Piwik\Settings\UserSetting;
/**
* Defines Settings for CustomOptOut.
*
* Usage like this:
* $settings = new Settings('CustomOptOut');
* $settings->autoRefresh->getValue();
* $settings->metric->getValue();
*
*/
class Settings extends \Piwik\Plugin\Settings
{
/**
* @var UserSetting
*/
public $enableEditor;
/**
* @var UserSetting
*/
public $editorTheme;
protected function init()
{
$this->setIntroduction('Custom OptOut');
$this->createEnableEditorSetting();
$this->createThemeSetting();
}
private function createEnableEditorSetting()
{
$this->enableEditor = new SystemSetting(
'enableEditor',
Piwik::translate('CustomOptOut_ShowEditorOptionName')
);
$this->enableEditor->type = static::TYPE_BOOL;
$this->enableEditor->uiControlType = static::CONTROL_CHECKBOX;
$this->enableEditor->description = Piwik::translate('CustomOptOut_ShowEditorDescription');
$this->enableEditor->defaultValue = true;
$this->addSetting($this->enableEditor);
}
private function createThemeSetting()
{
$this->editorTheme = new SystemSetting(
'editorTheme',
Piwik::translate('CustomOptOut_EditorThemeOptionName')
);
$this->editorTheme->type = static::TYPE_STRING;
$this->editorTheme->uiControlType = static::CONTROL_SINGLE_SELECT;
$this->editorTheme->description = Piwik::translate('CustomOptOut_EditorThemeDescription');
$this->editorTheme->defaultValue = 'default';
$this->editorTheme->availableValues = array(
'default' => 'Bright Theme',
'blackboard' => 'Dark Theme',
);
$this->addSetting($this->editorTheme);
}
}