|
3 | 3 | * @author : Jakiboy
|
4 | 4 | * @package : FloatPHP
|
5 | 5 | * @subpackage : Kernel Component
|
6 |
| - * @version : 1.1.0 |
| 6 | + * @version : 1.2.x |
7 | 7 | * @copyright : (c) 2018 - 2024 Jihad Sinnaour <[email protected]>
|
8 | 8 | * @link : https://floatphp.com
|
9 | 9 | * @license : MIT
|
@@ -34,11 +34,13 @@ public function __construct()
|
34 | 34 | }
|
35 | 35 |
|
36 | 36 | /**
|
| 37 | + * Check permission. |
| 38 | + * |
37 | 39 | * @access public
|
38 |
| - * @param mixed $role |
| 40 | + * @param string $role |
39 | 41 | * @return bool
|
40 | 42 | */
|
41 |
| - public function hasPermissions($role = false) : bool |
| 43 | + public function hasPermissions(?string $role = null) : bool |
42 | 44 | {
|
43 | 45 | if ( $this->isPermissions() ) {
|
44 | 46 | if ( $role ) {
|
@@ -74,31 +76,31 @@ public function getModulesRoutes()
|
74 | 76 | * Add module js.
|
75 | 77 | *
|
76 | 78 | * @access protected
|
77 |
| - * @param string $js |
| 79 | + * @param string $path |
78 | 80 | * @param string $hook
|
79 | 81 | * @return void
|
80 | 82 | */
|
81 |
| - protected function addJS($js, $hook = 'add-js') |
| 83 | + protected function addJS(string $path, string $hook = 'add-js') |
82 | 84 | {
|
83 |
| - $this->addAction($hook, function() use($js) { |
84 |
| - $tpl = $this->applyFilter('module-view-js', 'system/js'); |
85 |
| - $this->render(['js' => "{$this->getModulesUrl()}/{$js}"], $tpl); |
| 85 | + $this->addAction($hook, function() use($path) { |
| 86 | + $file = $this->applyFilter('module-view-js', 'system/js'); |
| 87 | + $this->render($file, ['js' => "{$this->getModulesUrl()}/{$path}"]); |
86 | 88 | });
|
87 | 89 | }
|
88 | 90 |
|
89 | 91 | /**
|
90 | 92 | * Add module css.
|
91 | 93 | *
|
92 | 94 | * @access protected
|
93 |
| - * @param string $css |
| 95 | + * @param string $path |
94 | 96 | * @param string $hook
|
95 | 97 | * @return void
|
96 | 98 | */
|
97 |
| - protected function addCSS($css, $hook = 'add-css') |
| 99 | + protected function addCSS(string $path, string $hook = 'add-css') |
98 | 100 | {
|
99 |
| - $this->addAction($hook, function() use($css){ |
100 |
| - $tpl = $this->applyFilter('module-view-css', 'system/css'); |
101 |
| - $this->render(['css' => "{$this->getModulesUrl()}/{$css}"], $tpl); |
| 101 | + $this->addAction($hook, function() use($path){ |
| 102 | + $file = $this->applyFilter('module-view-css', 'system/css'); |
| 103 | + $this->render($file, ['css' => "{$this->getModulesUrl()}/{$path}"]); |
102 | 104 | });
|
103 | 105 | }
|
104 | 106 |
|
|
0 commit comments