-
Notifications
You must be signed in to change notification settings - Fork 2
/
Plugin.php
119 lines (107 loc) · 3.83 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php namespace Octoshop\Core;
use App;
use Backend;
use Event;
use Illuminate\Foundation\AliasLoader;
use System\Classes\PluginBase;
class Plugin extends PluginBase
{
protected $components = [];
public function boot()
{
App::register('\Octoshop\Core\CartServiceProvider');
AliasLoader::getInstance()->alias('Cart', '\Octoshop\Core\Facades\Cart');
}
public function pluginDetails()
{
return [
'name' => 'octoshop.core::lang.plugin.name',
'icon' => 'icon-shopping-cart',
'author' => 'Dave Shoreman',
'homepage' => 'http://octoshop.co/',
'description' => 'octoshop.core::lang.plugin.description',
];
}
public function registerComponents()
{
$this->components = [
'Octoshop\Core\Components\Basket' => 'shopBasket',
'Octoshop\Core\Components\Products' => 'shopProducts',
'Octoshop\Core\Components\Product' => 'shopProduct',
];
Event::fire('octoshop.core.extendComponents', [$this]);
return $this->components;
}
public function addComponents($components)
{
return $this->components = array_replace($this->components, $components);
}
public function registerMarkupTags()
{
return [
'filters' => [
'currency' => ['Octoshop\Core\Util\Currency', 'format'],
'thumbnail' => ['Octoshop\Core\Util\Image', 'thumbnail'],
],
];
}
public function registerNavigation()
{
return [
'octoshop' => [
'label' => 'octoshop.core::lang.plugin.menu_label',
'url' => Backend::url('octoshop/core/products'),
'icon' => 'icon-shopping-cart',
'order' => 300,
'permissions' => [
'octoshop.core.*',
],
'sideMenu' => [
'products' => [
'label' => 'octoshop.core::lang.menu.products',
'url' => Backend::url('octoshop/core/products'),
'icon' => 'icon-cubes',
'order' => 200,
'permissions' => ['octoshop.core.access_products']
],
],
],
];
}
public function registerPermissions()
{
return [
'octoshop.core.access_products' => [
'tab' => 'octoshop.core::lang.plugin.name',
'label' => 'octoshop.core::lang.permissions.products',
],
'octoshop.core.access_settings' => [
'tab' => 'octoshop.core::lang.plugin.name',
'label' => 'octoshop.core::lang.permissions.settings',
],
];
}
public function registerSettings()
{
return [
'currency' => [
'label' => 'octoshop.core::lang.settings.currency.label',
'description' => 'octoshop.core::lang.settings.currency.description',
'category' => 'octoshop.core::lang.plugin.name',
'icon' => 'icon-gbp',
'class' => 'Octoshop\Core\Models\CurrencySettings',
'order' => 160,
'permissions' => ['octoshop.core.access_settings'],
],
'shop' => [
'label' => 'octoshop.core::lang.settings.shop.label',
'description' => 'octoshop.core::lang.settings.shop.description',
'category' => 'octoshop.core::lang.plugin.name',
'icon' => 'icon-sliders',
'class' => 'Octoshop\Core\Models\ShopSetting',
'order' => 150,
'permissions' => ['octoshop.core.access_settings'],
],
];
}
}