-
Notifications
You must be signed in to change notification settings - Fork 0
/
Plugin.php
67 lines (60 loc) · 2.13 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
<?php namespace OFFLINE\BootstrapBoxes;
use Cms\Classes\Controller;
use October\Rain\Support\Facades\Event;
use OFFLINE\BootstrapBoxes\Models\TestModel;
use OFFLINE\Boxes\Classes\Events;
use OFFLINE\Boxes\Models\Box;
use System\Classes\PluginBase;
use System\Models\File;
/**
* Plugin Information File
*/
class Plugin extends PluginBase
{
public $require = ['OFFLINE.Boxes'];
/**
* Returns information about this plugin.
*
* @return array
*/
public function pluginDetails()
{
return [
'name' => 'BootstrapBoxes',
'description' => 'No description provided yet...',
'author' => 'OFFLINE',
'icon' => 'icon-leaf'
];
}
/**
* Register method, called when the plugin is first registered.
*
* @return string[]
*/
public function register()
{
Box::extend(function (Box $box) {
$box->attachOne['logo'] = File::class;
$box->addDynamicMethod('getIconNameOptions', function () {
return include('icons.php');
});
});
Event::listen(
\OFFLINE\Boxes\Classes\Events::REGISTER_PARTIAL_PATH,
fn () => ['$/plugins/offline/bootstrapboxes/partials']
);
Event::listen('cms.page.init', function (Controller $controller) {
$controller->addJs('https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js', [
'integrity' => 'sha384-pprn3073KE6tl6bjs2QrFaJGz5/SUsLqktiwsUTF55Jfv3qYSDhgCecCxMW52nD2',
'crossorigin' => 'anonymous',
'async' => 'async',
]);
$controller->addCss('/plugins/offline/bootstrapboxes/assets/css/custom.css');
$controller->addCss('https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css', [
'integrity' => 'sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor',
'crossorigin' => 'anonymous',
]);
$controller->addCss('https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css');
});
}
}