如果管理员已登录,则在每个页面中显示奏鸣曲管理员菜单 [英] show sonata admin menu in every page if the admin is logged in
问题描述
如何在管理区域外使用奏鸣曲管理菜单?
how can i use the sonata admin menu out side the admin area?
即,当用户登录时,它只会显示标准菜单,但当管理员登录时,它会在每页显示两个菜单.
i.e,when a user logged in it will show only the standard menu but when the admin is logged in it will show two menu in every page.
先谢谢你.
表示管理菜单将显示在我的主菜单上方??????
means the admin menu will show above my home main menu??????
如果两个菜单可以合二为一,那一定是appriciate.thank you
and also if the two menu can be one that must be appriciate.thank you
推荐答案
此导航栏位于 SonataAdminBundle 主布局 (Sonata/AdminBundle/Resources/views/standard_layout.html.twig) 中.
This navigation bar is in the SonataAdminBundle main layout (Sonata/AdminBundle/Resources/views/standard_layout.html.twig).
如果你想在你的布局中使用它,你必须在你自己的模板中复制/粘贴导航栏代码,并确保你的视图可以访问所需的变量(主要是admin_pool"):
If you want to use it in your layout, you have to copy/paste the navbar code in your own template and be sure your view can access to required variables (mostly "admin_pool"):
return $this->render('YourBundle:View:template.html.twig', array(
'admin_pool' => $this->get('sonata.admin.pool'),
...
这对你有帮助.
这篇关于如果管理员已登录,则在每个页面中显示奏鸣曲管理员菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!