這裏是簡單的解決辦法
在控制器,你需要寫
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']
]
]
]
];
}
謝謝你的回答,我現在明白這個方法,但是它仍然沒有渲染側邊欄 – muuk 2014-12-07 16:55:05
好吧,算出來了。使用您發佈的文檔鏈接。不能相信我之前沒有找到那個,因爲我一直在搜索這個文檔很久。無論如何,謝謝 – muuk 2014-12-07 17:01:29
設置菜單上下文時,可能會阻止邊欄顯示的另一個問題是控制器上的駱駝外殼不正確。示例(Bigcompany而不是BigCompany [假設BigCompany是聲明的NS]): BackendMenu :: setContext('Bigcompany.SystemSales','products'); – 2017-05-29 19:54:32