-
Notifications
You must be signed in to change notification settings - Fork 1
/
Plugin.php
101 lines (80 loc) · 2.6 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
namespace ZachCO\TemplatePlugin;
use System\Classes\PluginBase;
class Plugin extends PluginBase {
/**
* @var bool Plugin requires elevated permissions.
*/
public $elevated = false;
/**
* @var array Plugin dependencies
*/
public $require = [];
/**
* Returns plugin info. plugin.yaml is preferred.
*/
//public function pluginDetails() {}
//public function register() {}
public function boot() {
Validator::extend(Rules\MyRule::NAME, Rules\MyRule::class);
}
//public function registerMarkupTags() {}
public function registerComponents() {
return [
Components\ComponentTemplate::class => Components\ComponentTemplate::SHORT_NAME,
];
}
//public function registerNavigation() {}
public function registerPermissions() {
return [
'zachco.templateplugin.access_settings' => [
'label' => 'zachco.templateplugin::lang.permission.access_settings',
'tab' => 'zachco.templateplugin::lang.permission_tab.plugin',
'order' => 200,
'roles' => [
// role API codes
]
],
];
}
public function registerSettings() {
return [
'settings' => [
'label' => 'zachco.templateplugin::lang.settings.label',
'description' => 'zachco.templateplugin::lang.settings.description',
'category' => 'zachco.templateplugin::lang.settings.category',
'icon' => 'icon-cog',
'class' => Models\Settings::class,
'order' => 500,
'keywords' => 'zachco',
'permissions' => [
'zachco.templateplugin.access_settings'
]
],
];
}
//public function registerFormWidgets() {}
//public function registerReportWidgets() {}
/*
public function registerListColumnTypes() {
return [
Classes\MyColumnType::SHORT_NAME => Classes\MyColumnType,
];
}
*/
//public function registerMailLayouts() {}
//public function registerMailTemplates() {}
//public function registerMailPartials() {}
/*
public function registerSchedule($schedule) {
// Call method daily
$schedule->call(function() {
// ...
})->daily();
// Run command
$schedule->command('cache:clear')->daily();
// Execute OS command
$schedule->exec('node /home/acme/script.js')->daily();
}
*/
}