-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathPlugin.php
85 lines (67 loc) · 2.35 KB
/
Plugin.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
82
83
84
85
<?php
namespace JanVince\SmallGDPR;
use System\Classes\PluginBase;
use System\Classes\PluginManager;
use JanVince\SmallGDPR\Models\CookiesSettings;
use Config;
use Backend;
use Validator;
use Log;
use Yaml;
use File;
use Storage;
class Plugin extends PluginBase {
public function boot() {
// dump( CookiesSettings::get('cookies') );
}
public function registerSettings() {
return [
'cookies' => [
'label' => 'janvince.smallgdpr::lang.settings.cookies.name',
'description' => 'janvince.smallgdpr::lang.settings.cookies.description',
'category' => 'GDPR',
'icon' => 'icon-desktop',
'class' => 'JanVince\SmallGDPR\Models\CookiesSettings',
'keywords' => 'gdpr cookies bar consent',
'order' => 990,
'permissions' => ['janvince.smallgdpr.access_cookies_settings'],
],
];
}
public function registerComponents() {
return [
'JanVince\SmallGDPR\Components\CookiesBar' => 'cookiesBar',
'JanVince\SmallGDPR\Components\CookiesManage' => 'cookiesManage',
];
}
public function registerMarkupTags() {
$settings = CookiesSettings::instance();
$pluginManager = \System\Classes\PluginManager::instance()->findByIdentifier('Rainlab.Translate');
if ($pluginManager && !$pluginManager->disabled) {
$settings->translateContext(\RainLab\Translate\Classes\Translator::instance()->getLocale());
}
return [
'filters' => [],
'functions' => [
'cookiesSettingsGet' => function ($value, $default = NULL) use ($settings){
if(empty($settings->$value)) {
return $default;
} else {
return $settings->$value;
}
}
]
];
}
public function registerFormWidgets() {
return [
'JanVince\SmallGDPR\FormWidgets\ImportPreset' => 'importpreset',
'JanVince\SmallGDPR\FormWidgets\ExportPreset' => 'exportpreset',
];
}
public function registerPageSnippets() {
return [
'\JanVince\SmallGDPR\Components\CookiesManage' => 'cookiesManage'
];
}
}