1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Services\Navigation\Menu; |
4
|
|
|
|
5
|
|
|
use Html; |
6
|
|
|
use Spatie\Menu\Laravel\Link; |
7
|
|
|
use Spatie\Menu\Laravel\Menu; |
8
|
|
|
|
9
|
|
|
class BackMenus |
10
|
|
|
{ |
11
|
|
|
public function register() |
12
|
|
|
{ |
13
|
|
|
Menu::macro('back', function () { |
14
|
|
|
return Menu::new() |
15
|
|
|
->setActiveClass('-active') |
16
|
|
|
->setActiveFromRequest('/blender'); |
17
|
|
|
}); |
18
|
|
|
|
19
|
|
|
Menu::macro('moduleGroup', function ($title) { |
20
|
|
|
return Menu::back() |
21
|
|
|
->addParentClass('menu__group') |
22
|
|
|
->setParentAttribute('data-menu-group', fragment("back.nav.{$title}")) |
23
|
|
|
->registerFilter(function (Link $link) { |
24
|
|
|
$link->addParentClass('menu__group__item'); |
25
|
|
|
}); |
26
|
|
|
}); |
27
|
|
|
|
28
|
|
|
Menu::macro('module', function (string $action, string $name) { |
29
|
|
|
return $this->action("Back\\{$action}", fragment("back.{$name}")); |
|
|
|
|
30
|
|
|
}); |
31
|
|
|
|
32
|
|
|
Menu::macro('backMain', function () { |
33
|
|
|
return Menu::back() |
34
|
|
|
->addClass('menu__groups') |
35
|
|
|
->setAttribute('data-menu-groups') |
36
|
|
|
->add(Menu::moduleGroup('content') |
37
|
|
|
->module('ArticlesController@index', 'articles.title') |
38
|
|
|
->module('NewsController@index', 'news.title') |
39
|
|
|
->module('PeopleController@index', 'people.title')) |
40
|
|
|
->add(Menu::moduleGroup('modules') |
41
|
|
|
->module('FragmentsController@index', 'fragments.title') |
42
|
|
|
->module('FormResponsesController@showDownloadButton', 'formResponses.title') |
43
|
|
|
->module('TagsController@index', 'tags.title')) |
44
|
|
|
->add(Menu::moduleGroup('users') |
45
|
|
|
->module('MembersController@index', 'members.title') |
46
|
|
|
->module('AdministratorsController@index', 'administrators.title')) |
47
|
|
|
->add(Menu::moduleGroup('system') |
48
|
|
|
->module('ActivitylogController@index', 'log.title') |
49
|
|
|
->module('RedirectsController@index', 'redirects.title') |
50
|
|
|
->module('StatisticsController@index', 'statistics.menuTitle')); |
51
|
|
|
}); |
52
|
|
|
|
53
|
|
|
Menu::macro('backUser', function () { |
54
|
|
|
$avatar = Html::avatar(current_user(), '-small'). |
55
|
|
|
el('span.:response-desktop-only', current_user()->email); |
56
|
|
|
|
57
|
|
|
return Menu::new() |
58
|
|
|
->action('Back\AdministratorsController@edit', $avatar, [current_user()->id]) |
59
|
|
|
->html(view('back.auth._partials.logoutForm')); |
|
|
|
|
60
|
|
|
}); |
61
|
|
|
|
62
|
|
|
Menu::macro('breadcrumbs', function (array $breadcrumbs) { |
63
|
|
|
return Menu::build($breadcrumbs, function (Menu $menu, $actionWithParameters, $label) { |
64
|
|
|
if (! is_array($actionWithParameters)) { |
65
|
|
|
$actionWithParameters = [$actionWithParameters]; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
$action = array_shift($actionWithParameters); |
69
|
|
|
|
70
|
|
|
return $menu->action($action, $label, $actionWithParameters); |
71
|
|
|
})->addClass('breadcrumb')->setActiveFromRequest('/blender'); |
72
|
|
|
}); |
73
|
|
|
} |
74
|
|
|
} |
75
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.