-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPlugin.php
70 lines (61 loc) · 1.98 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
<?php namespace NumenCode\Fundamentals;
use System\Classes\PluginBase;
use Winter\Translate\Classes\EventRegistry;
use NumenCode\Fundamentals\Bootstrap\ConfigOverride;
use NumenCode\Fundamentals\Extensions\TwigExtension;
use NumenCode\Fundamentals\Bootstrap\BackendOverride;
use NumenCode\Fundamentals\Bootstrap\FormWidgetsOverride;
use NumenCode\Fundamentals\Extensions\EventRegistryExtension;
class Plugin extends PluginBase
{
public function pluginDetails()
{
return [
'name' => 'numencode.fundamentals::lang.plugin.name',
'description' => 'numencode.fundamentals::lang.plugin.description',
'author' => 'Blaz Orazem',
'icon' => 'oc-icon-cogs',
'homepage' => 'https://github.com/numencode/wn-fundamentals-plugin',
];
}
public function boot()
{
(new ConfigOverride())->init();
(new BackendOverride())->init();
}
public function register()
{
$this->registerHelpers();
$this->registerTranslatable();
}
protected function registerHelpers()
{
require_once __DIR__ . '/helpers.php';
}
protected function registerTranslatable()
{
// Override event registry to enable repeater translations
if (plugin_exists('Winter.Translate')) {
app()->singleton(EventRegistry::class, function () {
return EventRegistryExtension::instance();
});
}
}
public function registerMarkupTags()
{
return [
'filters' => TwigExtension::filters(),
'functions' => TwigExtension::functions(),
];
}
public function registerFormWidgets()
{
(new FormWidgetsOverride())->init();
return [
'NumenCode\Fundamentals\FormWidgets\TranslatableHelper' => [
'label' => 'numencode.fundamentals::lang.form.translatable',
'code' => 'translatable',
],
];
}
}