forked from ProcessMaker/processmaker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenuManager.php
More file actions
39 lines (31 loc) · 1.01 KB
/
MenuManager.php
File metadata and controls
39 lines (31 loc) · 1.01 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
<?php
namespace ProcessMaker\Managers;
use Illuminate\Support\Facades\View;
class MenuManager extends \Lavary\Menu\Menu
{
/**
* Create a new menu builder instance.
*
* @param string $name
* @param callable $callback
* @param array $options (optional, it will be combined with the options to be applied)
*
* @return Builder
*/
public function make($name, $callback, array $options = [])
{
if (!is_callable($callback)) {
return null;
}
if (!array_key_exists($name, $this->menu)) {
$this->menu[$name] = new MenuBuilder($name, array_merge($this->loadConf($name), $options));
}
// Registering the items
call_user_func($callback, $this->menu[$name]);
// Storing each menu instance in the collection
$this->collection->put($name, $this->menu[$name]);
// Make the instance available in all views
View::share($name, $this->menu[$name]);
return $this->menu[$name];
}
}