Repository navigation
Expand file tree
/
Copy pathMain.php
More file actions
95 lines (83 loc) · 2.68 KB
/
Copy pathMain.php
File metadata and controls
95 lines (83 loc) · 2.68 KB
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
<?php
/**
* @package Bootstrap Select
* @author Iurii Makukh <gplcart.software@gmail.com>
* @copyright Copyright (c) 2017, Iurii Makukh <gplcart.software@gmail.com>
* @license https://www.gnu.org/licenses/gpl-3.0.en.html GPL-3.0+
*/
namespace gplcart\modules\bootstrap_select;
use gplcart\core\Module;
/**
* Main class for Bootstrap Select module
*/
class Main
{
/**
* Module class instance
* @var \gplcart\core\Module $module
*/
protected $module;
/**
* @param Module $module
*/
public function __construct(Module $module)
{
$this->module = $module;
}
/**
* Implements hook "library.list"
* @param array $libraries
*/
public function hookLibraryList(array &$libraries)
{
$libraries['bootstrap_select'] = array(
'name' => 'Bootstrap Select', // @text
'description' => "A jQuery plugin that utilizes Bootstrap's dropdown.js to style and bring additional functionality to standard select elements", // @text
'type' => 'asset',
'module' => 'bootstrap_select',
'url' => 'https://github.com/silviomoreto/bootstrap-select',
'download' => 'https://github.com/silviomoreto/bootstrap-select/archive/v1.12.1.zip',
'version' => '1.12.1',
'files' => array(
'dist/js/bootstrap-select.min.js',
'dist/css/bootstrap-select.min.css',
),
'dependencies' => array(
'jquery' => '>= 1.8',
'bootstrap' => '>= 3.0',
),
);
}
/**
* Implements hook "route.list"
* @param array $routes
*/
public function hookRouteList(array &$routes)
{
$routes['admin/module/settings/bootstrap_select'] = array(
'access' => 'module_edit',
'handlers' => array(
'controller' => array('gplcart\\modules\\bootstrap_select\\controllers\\Settings', 'editSettings')
)
);
}
/**
* Implements hook "construct.controller.backend"
* @param \gplcart\core\controllers\backend\Controller $controller
*/
public function hookConstructControllerBackend($controller)
{
$this->addLibrary($controller);
}
/**
* Add Bootstrap Select library and additional assets
* @param \gplcart\core\Controller $controller
*/
public function addLibrary($controller)
{
$settings = $this->module->getSettings('bootstrap_select');
$controller->setJsSettings('bootstrap_select', $settings);
$controller->addAssetLibrary('bootstrap_select');
$controller->setJs('system/modules/bootstrap_select/js/common.js');
}
}