Browse Source

Initial

master
dimti 5 years ago
commit
6784cecf5e
  1. 1
      .gitignore
  2. 205
      Plugin.php
  3. 41
      README-RU.md
  4. 41
      README.md
  5. 11
      assets/css/_wms_extend_menu.css
  6. 218
      classes/Extend.php
  7. 27
      controllers/Index.php
  8. 14
      controllers/index/index.htm
  9. 16
      helpers/Menu.php
  10. 5
      lang/en/lang.php
  11. 8
      lang/en/plugin.php
  12. 5
      lang/ru/lang.php
  13. 8
      lang/ru/plugin.php
  14. 36
      partials/menu/main/_system_sidebar.phtml
  15. 52
      partials/menu/main/_system_sidebar_menu.phtml
  16. 14
      partials/menu/main/_system_sidebar_menu_toolbar.phtml
  17. 81
      partials/menu/secondary/_sidenav.phtml
  18. 31
      partials/menu/secondary/_sidenav_sidebar_menu.phtml
  19. 9
      routes.php
  20. 1
      updates/version.yaml

1
.gitignore

@ -0,0 +1 @@
.idea

205
Plugin.php

@ -0,0 +1,205 @@
<?php
namespace Wms\Menu;
use Backend\Classes\Controller as BackendController;
use Cms\Classes\Controller as CmsController;
use Cms\Classes\Page as CmsPage;
use System\Classes\PluginBase;
/**
* Menu Plugin Information File
*/
class Plugin extends PluginBase
{
protected const ICON = 'icon-sliders';
/**
* @var CmsController
*/
protected $cmsController;
protected $defaultMenuName = 'wms.menu::plugin.default-menu';
protected $navigation = [
'first' => null,
'sideMenu' => [],
'subMenus' => [],
'permissions' => [],
];
public function pluginDetails()
{
return [
'name' => 'wms.menu::plugin.name',
'description' => 'wms.menu::plugin.description',
'author' => 'WMStudio',
'icon' => self::ICON,
];
}
public function register()
{
BackendController::extend(function($controller) {
/* @var $controller BackendController */
$controller->addDynamicMethod('getMenu', function($name) {
return isset($this->navigation['subMenus'][$name]) ? $this->navigation['subMenus'][$name] : null;
});
});
/**
* Скрывает содержимое заголовка или после символа `, или между символами ``
* прим:
* "Заголовок `Скрытый тектс"
* "`Скрытый текст` Заголовок"
*/
CmsPage::extend(function($page) {
/* @var $page CmsPage */
$page->addDynamicMethod('getTitle', function($withHidden = false) use (&$page) {
$title = $page->title;
if (($pos = mb_strpos($title, '`')) === false) {
return $title;
}
if ($withHidden) {
return str_replace('`', '', $title);
} else {
$result = mb_substr($title, 0, $pos);
$title = mb_substr($title, $pos + 1);
if (($pos = mb_strpos($title, '`')) === false) {
return $result;
}
return trim($result . mb_substr($title, $pos + 1));
}
});
});
\Event::listen('cms.page.beforeRenderPage', function($controller, $page) {
/* @var $page CmsPage */
$config = $page->theme->getConfig();
$page->theme->menu = $this->getMenu(optional($config)['menu'] ?: [], !!optional($config)['pageTitleMoreImportant']);
});
}
public function registerNavigation()
{
list($navigation, $defaultMenuName) = Classes\Extend::collectNavigation($this->defaultMenuName, self::ICON);
if ($navigation) {
$this->navigation = $navigation;
}
if ($defaultMenuName) {
$this->defaultMenuName = $defaultMenuName;
}
$navigation = [];
if (count($this->navigation['sideMenu'])) {
\BackendMenu::registerContextSidenavPartial('Wms.Menu', 'main', '~/plugins/wms/menu/partials/menu/main/_system_sidebar.phtml');
$navigation['main'] = [
'label' => 'wms.menu::plugin.name',
'url' => $this->navigation['first'] ?: \Backend::url('wms/menu'),
'icon' => self::ICON,
'permissions' => array_keys($this->navigation['permissions']),
'order' => 999, // before CMS Settings
'sideMenu' => $this->navigation['sideMenu'],
];
if (is_array($this->navigation['subMenus'])) {
foreach ($this->navigation['subMenus'] as $name => $menu) {
if (!isset($navigation[$name])) {
\BackendMenu::registerContextSidenavPartial('Wms.Menu', $name, '~/plugins/wms/menu/partials/menu/secondary/_sidenav.phtml');
}
}
}
}
return $navigation;
}
protected function getPage($name, $title = null, $pageTitleMoreImportant = false, $active = null, $attributes = [])
{
/* @var $page CmsPage */
if (!$this->cmsController) {
$this->cmsController = CmsController::getController() ?: new CmsController;
}
$page = CmsPage::find($name);
if (!$page) {
$result = [
'url' => '#',
'name' => $title ?? $name,
'class' => optional($attributes)['class'],
'attributes' => $this->renderAttributes($attributes),
];
} else {
$result = [
'url' => $this->cmsController->pageUrl($name, false),
'name' => $pageTitleMoreImportant ? $page->getTitle(true) : (($title ?? $page->getTitle(true)) ?: $name),
'class' => optional($attributes)['class'],
'attributes' => $this->renderAttributes($attributes),
];
}
$current = CmsPage::url('');
if ($current == $result['url']) {
$result['active'] = true;
} elseif ($active) {
if (is_string($active) && $current == CmsPage::url($active)) {
$result['active'] = true;
} elseif (is_array($active)) {
$isActive = false;
foreach ($active as $page) {
if ($isActive) {
break;
}
if ($current == CmsPage::url($page)) {
$isActive = true;
}
}
if ($isActive) {
$result['active'] = true;
}
}
}
return $result;
}
protected function getMenu($menu, $pageTitleMoreImportant = true)
{
$result = [];
foreach ($menu as $key => $value) {
if (!is_array($value)) {
$result[$key] = $this->getPage($key, $value, $pageTitleMoreImportant);
} else {
$result[$key] = $this->getPage(
$key,
optional($value)['name'],
$pageTitleMoreImportant,
optional($value)['active'],
optional($value)['attributes'] ?: []
);
if (isset($value['url'])) {
$result[$key]['url'] = url($value['url']);
}
if (isset($value['pages'])) {
$result[$key]['pages'] = $this->getMenu($value['pages'], $pageTitleMoreImportant);
}
}
}
return $result;
}
protected function renderAttributes($attributes)
{
$result = '';
foreach ($attributes as $name => $attribute) {
if ($name == 'class' || $name == 'href') {
continue;
}
$result .= "$name=\"$attribute\" ";
}
if (strlen($result)) {
$result = substr($result, 0, -1);
}
return $result;
}
}

41
README-RU.md

@ -0,0 +1,41 @@
# Menu plugin
Объединяет элементы меню из разных плагинов
Для добавления пунктов меню добавьте в класс `Plugin`
public function addToMainNavigation()
{
return [
'{tab_name}' => [
'{name}' => [
'label' => {label},
'url' => {url},
'permissions' => [{permission}, ...],
'icon' => {icon},
'order' => {order},
//'first' => true,
'subMenu' => [
'{tab_name}' => [
'{name}' => [
'label' => {label},
'url' => {url},
'permissions' => [{permission}, ...],
'icon' => {icon},
'order' => {order},
],
...
],
...
],
...
],
...
];
}
Имя вкладки по умолчанию {default_name}
Для изменения имени вкладки по умолчанию, в файле `Plugin.php`, объявите константу `DEFAULT_MENU_NAME`
Если указан `первый` элемент, то он будет сразу открываться при клике на меню.
Если нет, то будет открыта страница меню или подменю.

41
README.md

@ -0,0 +1,41 @@
# Menu plugin
Combines menu items from different plugins
To add menu items add to class`Plugin`
public function addToMainNavigation()
{
return [
'{tab_name}' => [
'{name}' => [
'label' => {label},
'url' => {url},
'permissions' => [{permission}, ...],
'icon' => {icon},
'order' => {order},
//'first' => true,
'subMenu' => [
'{tab_name}' => [
'{name}' => [
'label' => {label},
'url' => {url},
'permissions' => [{permission}, ...],
'icon' => {icon},
'order' => {order},
],
...
],
...
],
...
],
...
];
}
Default tab name is {default_name}
For change default tab name, in `Plugin.php` file, declare the constant `DEFAULT_MENU_NAME`
If the `first` element is specified, it will immediately open when you click on the menu.
If not, the menu or submenu page will be opened.

11
assets/css/_wms_extend_menu.css

@ -0,0 +1,11 @@
@media (max-width: 768px) {
.layout-cell.layout-sidenav-container.wms-menu {
display: none;
}
.sidenav-tree-root .sidenav-tree .back-link.wms-menu-back-link {
display: block !important;
}
.layout-cell.layout-sidenav-container ~ .layout-cell.sidenav-tree {
border: none;
}
}

218
classes/Extend.php

@ -0,0 +1,218 @@
<?php
namespace Wms\Menu\Classes;
use Backend\Models\User;
use System\Classes\PluginManager;
class Extend
{
/**
* @var User
*/
protected static $user;
/**
* @var PluginManager
*/
protected static $manager;
protected static $icon;
protected static $defaultMenuName;
protected static $navigation = [
'first' => null,
'sideMenu' => [],
'subMenus' => [],
'permissions' => [],
];
/**
* @param PluginManager $pluginManager
* @param string $defaultMenuName
* @param string $defaultIcon
* @return array
*/
public static function collectNavigation(string $defaultMenuName, string $defaultIcon): array
{
self::$manager = PluginManager::instance();
self::$defaultMenuName = $defaultMenuName;
self::$icon = $defaultIcon;
self::$user = \BackendAuth::getUser();
$navigation = self::getPluginsNavigation();
self::removeOrder($navigation);
if (!$navCount = count($navigation)) {
return [null, null];
}
foreach ($navigation as $group => $pages) {
if ($group == '{default_name}') {
$group = self::$defaultMenuName;
}
foreach ($pages as $name => $page) {
if ($page) {
self::$navigation['sideMenu'][$name] = [
'label' => isset($page['label']) ? $page['label'] : 'wms.menu::lang.no-name',
'group' => $group,
'url' => isset($page['url']) ? $page['url'] : '#',
'icon' => isset($page['icon']) ? $page['icon'] : 'icon-leaf',
'permissions' => isset($page['permissions']) ? $page['permissions'] : ['wms.*'],
];
}
}
}
return [
self::$navigation,
self::$defaultMenuName,
];
}
protected static function removeOrder(&$array, $name = null)
{
if ($name && isset($array['subMenu']) && is_array($array['subMenu'])) {
$subPermissions = [];
$subFirst = null;
$subCount = 0;
foreach ($array['subMenu'] as $subGroup => $subMenu) {
if ($subGroup == '{default_name}') {
$subGroup = self::$defaultMenuName;
}
foreach ($subMenu as $subName => $subPage) {
$subPermission = isset($subPage['permissions']) ? $subPage['permissions'] : ['wms.*'];
if (!is_array($subPermission)) {
$subPermission = [$subPermission];
}
$hasPermissions = false;
foreach ($subPermission as $perm) {
$hasPermissions = $hasPermissions || self::$user->hasPermission($perm);
}
if ($hasPermissions) {
$subUrl = isset($subPage['url']) ? $subPage['url'] : '#';
foreach ($subPermission as $perm) {
$subPermissions[$perm] = true;
}
if (!$subFirst && isset($subPage['first']) && $subPage['first'] && self::$user->hasPermission($subPermission)) {
$subFirst = $subUrl;
}
self::$navigation['subMenus'][$name][$subGroup][$subName] = [
'label' => isset($subPage['label']) ? $subPage['label'] : 'wms.menu::lang.no-name',
'group' => $subGroup,
'url' => $subUrl,
'icon' => isset($subPage['icon']) ? $subPage['icon'] : 'icon-leaf',
'permissions' => $subPermission,
];
$subCount++;
}
}
}
$subFirst = $subFirst ?: \Backend::url("wms/menu/$name");
if ($subFirst && $subCount) {
$array['url'] = $subFirst;
$array['permissions'] = array_keys($subPermissions);
unset($array['subMenu']);
} else {
$array = [];
}
}
foreach ($array as $key => $val) {
if (is_array($array[$key])) {
if (isset($array[$key]['order'])) {
unset($array[$key]['order']);
}
self::removeOrder($array[$key], $key);
}
}
if (isset($array['first']) && $array['first']) {
unset($array['first']);
if (!self::$navigation['first']) {
self::$navigation['first'] = self::getFirstUrl($array);
}
}
if (isset($array['permissions'])) {
foreach ($array['permissions'] as $permission) {
self::$navigation['permissions'][$permission] = true;
}
}
}
protected static function getFirstUrl($field)
{
if (!isset($field['url'])) {
return null;
}
$url = null;
if (isset($field['permissions'])) {
$hasPermissions = false;
if (!is_array($field['permissions'])) {
$field['permissions'] = [$field['permissions']];
}
foreach ($field['permissions'] as $permission) {
$hasPermissions = $hasPermissions || self::$user->hasPermission($permission);
}
if ($hasPermissions) {
$url = $field['url'];
}
} else {
$url = $field['url'];
}
return $url;
}
protected static function getPluginsNavigation()
{
$navigation = [];
foreach (self::$manager->getRegistrationMethodValues('addToMainNavigation') as $plugin => $subNavigation) {
if (empty($subNavigation)) {
continue;
}
$class = str_replace('.', '\\', $plugin) . '\Plugin';
if (defined($class . '::DEFAULT_MENU_NAME') && !empty($class::DEFAULT_MENU_NAME)) {
self::$defaultMenuName = $class::DEFAULT_MENU_NAME;
}
$details = self::$manager->getRegistrationMethodValues('pluginDetails');
if (isset($details[$plugin]['icon'])) {
$defaultIcon = $details[$plugin]['icon'];
} else {
$defaultIcon = self::$icon;
}
foreach ($subNavigation as $group => $pages) {
foreach ($pages as $name => $page) {
if (is_array($page)) {
if (!isset($page['icon'])) {
$subNavigation[$group][$name]['icon'] = $defaultIcon;
}
}
}
}
self::arrayMerge($navigation, $subNavigation);
}
return $navigation;
}
protected static function arrayMerge(&$array, $merge)
{
foreach ($merge as $key => $val) {
if (!is_array($val)) {
$array[$key] = $val;
} else {
if (!isset($array[$key])) {
$array[$key] = [];
}
self::arrayMerge($array[$key], $merge[$key]);
}
}
uasort($array, function(&$arr1, &$arr2) {
$order1 = isset($arr1['order']) ? $arr1['order'] : -1;
$order2 = isset($arr2['order']) ? $arr2['order'] : -1;
return $order1 == $order2 ? 0 : ($order1 < $order2 ? -1 : 1);
});
}
}

27
controllers/Index.php

@ -0,0 +1,27 @@
<?php
namespace Wms\Menu\Controllers;
use Backend\Classes\Controller;
/**
* Settings controller
*
* @package october\system
* @author Alexey Bobkov, Samuel Georges
*
*/
class Index extends Controller
{
public function __construct()
{
parent::__construct();
\BackendMenu::setContext('Wms.Menu', 'main');
}
public function index()
{
$this->pageTitle = 'wms.menu::plugin.name';
$this->bodyClass = 'compact-container sidenav-tree-root';
}
}

14
controllers/index/index.htm

@ -0,0 +1,14 @@
<div class="layout">
<div class="layout-cell oc-logo-transparent">
<script>
$(document).ready(function() {
var $search = $('#settings-search-input'),
focusSearch = function() {
setTimeout(function() { $search.focus().select() }, 10)
};
$search.on('blur', focusSearch);
focusSearch()
})
</script>
</div>
</div>

16
helpers/Menu.php

@ -0,0 +1,16 @@
<?php
namespace Wms\Menu\Helpers;
class Menu
{
public static function setMainActive($sideMenuItemCode = null)
{
\BackendMenu::setContext('Wms.Menu', 'main', $sideMenuItemCode);
}
public static function setSubnavActive($mainMenuItemCode, $sideMenuItemCode = null)
{
\BackendMenu::setContext('Wms.Menu', 'main', "$mainMenuItemCode|$sideMenuItemCode");
}
}

5
lang/en/lang.php

@ -0,0 +1,5 @@
<?php
return [
'no-name' => 'No name',
];

8
lang/en/plugin.php

@ -0,0 +1,8 @@
<?php
return [
'name' => 'Menu',
'description' => 'Combines menus from different plugins',
'default-menu' => 'Main',
'slogan' => 'In a secure future',
];

5
lang/ru/lang.php

@ -0,0 +1,5 @@
<?php
return [
'no-name' => 'Без имени',
];

8
lang/ru/plugin.php

@ -0,0 +1,8 @@
<?php
return [
'name' => 'Меню',
'description' => 'Объединяет меню из разных плагинов',
'default-menu' => 'Основное',
'slogan' => 'В надежное будущее',
];

36
partials/menu/main/_system_sidebar.phtml

@ -0,0 +1,36 @@
<?php
$context = BackendMenu::getContext();
if (strpos($context->sideMenuCode, '|') !== false) {
$menu = explode('|', $context->sideMenuCode);
$context->mainMenuCode = $menu[0];
$context->sideMenuCode = $menu[1];
}
if (isset($menu)):
?>
<?= $this->makePartial(__DIR__ . '/../secondary/_sidenav.phtml', [
'context' => $context,
]) ?>
<?php else: ?>
<div class="layout-cell sidenav-tree bg-p" data-control="sidenav-tree" data-search-input="#settings-search-input">
<a class="back-link" href="<?= Backend::url('wms/menu') ?>"><i class="icon-angle-left"></i><?= e(trans('wms.menu::plugin.name')) ?></a>
<div class="layout">
<div class="layout-row min-size">
<?= $this->makePartial(__DIR__ . '/_system_sidebar_menu_toolbar.phtml') ?>
</div>
<div class="layout-row">
<div class="layout-cell">
<div class="layout-relative">
<div class="layout-absolute">
<div class="control-scrollbar" data-control="scrollbar">
<?= $this->makePartial(__DIR__ . '/_system_sidebar_menu.phtml') ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php endif; ?>

52
partials/menu/main/_system_sidebar_menu.phtml

@ -0,0 +1,52 @@
<?php
if ($sideMenuItems = BackendMenu::listSideMenuItems()):
$collapsedGroups = explode('|',
isset($_COOKIE['sidenav_treegroupStatus'])
? $_COOKIE['sidenav_treegroupStatus']
: null
);
$categories = [];
foreach ($sideMenuItems as $sideItemCode => $item) {
if(!property_exists($item, 'group')) {
$item->group = 'default';
}
if(!property_exists($item, 'keywords')) {
$item->keywords = '';
}
if(!property_exists($item, 'description')) {
$item->description = '';
}
$categories[$item->group][$sideItemCode] = $item;
}
?>
<ul class="top-level">
<?php foreach ($categories as $category => $items):
$collapsed = in_array($category, $collapsedGroups); ?>
<li data-group-code="<?= e($category) ?>" <?= $collapsed ? 'data-status="collapsed"' : null ?>>
<div class="group">
<h3><?= e(trans($category)); ?></h3>
</div>
<ul>
<?php foreach ($items as $item):
$last_path = array_last(explode('/', request()->path())); ?>
<li class="<?=
((BackendMenu::isSideMenuItemActive($item) && empty($item->scontents))
|| (
isset($item->scontents)
&& $item->scontents == $last_path
))
? 'active'
: null;
?>" data-keywords="<?= e(trans($item->keywords)) ?>">
<a href="<?= $item->url ?>">
<i class="<?= $item->icon ?>"></i>
<span class="header"><?= e(trans($item->label)) ?></span>
<span class="description"><?= e(trans($item->description)) ?></span>
</a>
</li>
<?php endforeach ?>
</ul>
</li>
<?php endforeach ?>
</ul>
<?php endif; ?>

14
partials/menu/main/_system_sidebar_menu_toolbar.phtml

@ -0,0 +1,14 @@
<div class="layout control-toolbar">
<div class="layout-cell">
<div class="relative toolbar-item loading-indicator-container size-input-text">
<input placeholder="<?= e(trans('system::lang.settings.search')) ?>" type="text" name="search" value=""
class="form-control icon search"
id="settings-search-input"
autocomplete="off"
data-track-input
data-load-indicator
data-load-indicator-opaque
/>
</div>
</div>
</div>

81
partials/menu/secondary/_sidenav.phtml

@ -0,0 +1,81 @@
<?php
$mainMenuCode = 'main';
$sideMainMenuItems = BackendMenu::listSideMenuItems();
if (!isset($context)) {
$context = BackendMenu::getContext();
}
?>
<?php if ($sideMainMenuItems): ?>
<div class="layout-cell layout-sidenav-container wms-menu">
<div class="layout-relative">
<nav
id="layout-sidenav"
class="layout-sidenav bg-p"
data-active-class="active"
data-control="sidenav">
<ul class="nav">
<?php foreach ($sideMainMenuItems as $sideItemCode => $item): ?>
<li
class="<?= $context->mainMenuCode == $sideItemCode ? 'active' : null ?>"
<?= Html::attributes($item->attributes) ?>
>
<a href="<?= $item->url ?>">
<span class="nav-icon">
<?php if ($item->iconSvg): ?>
<img class="svg-icon" src="<?= Url::asset($item->iconSvg) ?>">
<?php endif ?>
<i class="<?= $item->iconSvg ? 'svg-replace' : null ?> <?= $item->icon ?>"></i>
</span>
<span class="nav-label">
<?= e(trans($item->label)) ?>
</span>
</a>
<span
class="counter <?= $item->counter === null ? 'empty' : null ?>"
data-menu-id="<?= e($mainMenuCode.'/'.$sideItemCode) ?>"
<?php if ($item->counterLabel): ?>title="<?= e(trans($item->counterLabel)) ?>"<?php endif ?>
>
<?= e($item->counter) ?>
</span>
</li>
<?php endforeach ?>
</ul>
</nav>
</div>
</div>
<?php endif ?>
<div class="layout-cell sidenav-tree bg-p" data-control="sidenav-tree" data-search-input="#settings-search-input">
<a class="back-link" href="<?= Backend::url('wms/menu' . (empty($context->sideMenuCode) ? '' : "/{$context->mainMenuCode}")) ?>">
<i class="icon-angle-left"></i><?= e(trans($context->mainMenuCode == $mainMenuCode || empty($context->sideMenuCode)
? 'wms.menu::plugin.name'
: "wms.site::lang.{$context->mainMenuCode}.title"
)) ?>
</a>
<div class="layout">
<a class="back-link wms-menu-back-link" href="<?= Backend::url('wms/menu' . (empty($context->sideMenuCode) ? '' : "/{$context->mainMenuCode}")) ?>">
<i class="icon-angle-left"></i><?= e(trans($context->mainMenuCode == $mainMenuCode || empty($context->sideMenuCode)
? 'wms.menu::plugin.name'
: "wms.site::lang.{$context->mainMenuCode}.title"
)) ?>
</a>
<div class="layout-row min-size">
<?= $this->makePartial(__DIR__ . '/../main/_system_sidebar_menu_toolbar.phtml'); ?>
</div>
<div class="layout-row">
<div class="layout-cell">
<div class="layout-relative">
<div class="layout-absolute">
<div class="control-scrollbar" data-control="scrollbar">
<?= $this->makePartial(__DIR__ . '/_sidenav_sidebar_menu.phtml', [
'context' => $context,
]) ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

31
partials/menu/secondary/_sidenav_sidebar_menu.phtml

@ -0,0 +1,31 @@
<?php
if ($sideMenuItems = $this->getMenu($context->mainMenuCode)):
$collapsedGroups = explode('|',
isset($_COOKIE['sidenav_treegroupStatus'])
? $_COOKIE['sidenav_treegroupStatus']
: null
);
?>
<ul class="top-level">
<?php foreach ($sideMenuItems as $category => $items):
$collapsed = in_array($category, $collapsedGroups); ?>
<li data-group-code="<?= e($category) ?>" <?= $collapsed ? 'data-status="collapsed"' : null ?>>
<div class="group">
<h3><?= e(trans($category)); ?></h3>
</div>
<ul>
<?php foreach ($items as $name => $item): ?>
<?php $keywords = isset($item['keywords']) ? e(trans($item['keywords'])) : ''; ?>
<li class="<?= $context->sideMenuCode == $name ? 'active' : null; ?>" data-keywords="<?= $keywords ?>">
<a href="<?= isset($item['url']) ? $item['url'] : '#'; ?>">
<i class="<?= isset($item['icon']) ? $item['icon'] : ''; ?>"></i>
<span class="header"><?= isset($item['label']) ? e(trans($item['label'])) : '' ?></span>
<span class="description"><?= isset($item['description']) ? e(trans($item['description'])) : '' ?></span>
</a>
</li>
<?php endforeach ?>
</ul>
</li>
<?php endforeach ?>
</ul>
<?php endif; ?>

9
routes.php

@ -0,0 +1,9 @@
<?php
use Wms\Menu\Controllers\Index as MenuControllers;
Route::get(config('cms.backendUri') . '/wms/menu/{menu}', function($menu) {
$controller = App::make(MenuControllers::class);
\BackendMenu::setContext('Wms.Menu', 'main', "$menu|");
return $controller->run('index', ['menu' => $menu]);
})->middleware('web');

1
updates/version.yaml

@ -0,0 +1 @@
1.0.1: First version of Menu
Loading…
Cancel
Save