我一直在努力熟悉octobercms,但我遇到了一个我似乎无法解决的问题。我有一个带有视图等的后端控制器设置。除了侧边栏没有加载外,一切正常。此选项卡也未获得活动状态。
http://gyazo.com/25e019c1db34d5807c05ebb4b3277ac7
看起来应该是这样的:
http://gyazo.com/c71a1e1dec7c1e6b81136b313b32da47
以下是我的代码的要点:https://gist.github.com/muuknl/fedb8434219c7dbe5d04
如果我忘记提供某些信息,请告诉我并提前感谢您的帮助。
答案 0 :(得分:6)
这里是简单的解决方案
在控制器中你需要写BackendMenu::setContext('Archetypics.Team', 'website', 'team');
参考此https://octobercms.com/docs/backend/controllers-views-ajax#navigation-context
BackendMenu::setContext('Author.Plugin name', 'Menu code', 'Sub menu code');
你需要在registerNavigation()函数中用plugin.php
写下你所写的内容
public function registerNavigation()
{
return [
// menu code
'website' => [
'label' => 'Website',
'url' => Backend::url('muukrls/archetypics/team'),
'icon' => 'icon-pencil',
'permissions' => ['archetypics.*'],
'order' => 500,
'sideMenu' => [
'home' => [
'label' => 'Homepage',
'icon' => 'icon-copy',
'url' => Backend::url('muukrls/archetypics/home'),
'permissions' => ['archetypics.home_access'],
],
'about' => [
'label' => 'About Page',
'icon' => 'icon-list-ul',
'url' => Backend::url('muukrls/archetypics/about'),
'permissions' => ['archetypics.about_access'],
],
// sub menu code
'team' => [
'label' => 'Team Members',
'icon' => 'icon-users',
'url' => Backend::url('muukrls/archetypics/team'),
'permissions' => ['archetypics.team_access']
]
]
]
];
}