如何将Magento管理菜单链接到角色资源

Chr*_*ung 5 magento

情况如下:

我想在Magento后端导航菜单中添加一个菜单.
我通过添加以下代码完成了这个app/etc/config.xml:

<adminhtml>
<menu>
    <example translate="title" module="adminhtml">
        <title>Inventory</title>
        <sort_order>110</sort_order>
        <children>
            <set_time>
                <title>Set It!</title>
                <action>helloworld/index/goodbye</action>
            </set_time>
        </children>
    </example>
</menu> 
Run Code Online (Sandbox Code Playgroud)

问题是我无法在权限 - >角色资源中包含此菜单,因此我无法将其分配给特定用户.

如何在权限 - >角色资源中包含此菜单?

谢谢你,更有力量!

sil*_*lvo 6

您需要告诉magento您希望新的菜单位置在权限树中可见.为此,您必须在配置数据中添加ACL部分.把它放在模块的config.xml文件中:

     <acl>
        <resources>
            <admin>
                <children>
                    <example>
                            <title>Inventory</title>
                            <sort_order>110</sort_order>
                            <children>
                                <set_time>
                                    <title>Set It!</title>
                                    <sort_order>0</sort_order>
                                </set_time>
                            </children>
                    </example>
                </children>
            </admin>
        </resources>
    </acl>
Run Code Online (Sandbox Code Playgroud)


Chr*_*ung 1

谢谢..我通过一些调整让它可以工作..

<adminhtml>
    <acl>
        <resources>
            <admin>
                <children>

 <helloworld_options translate="label" module="helloworld">
  <title> MENU</title>
                    <sort_order>999</sort_order>
                    <children>
   <hello_children1>
    <title> RELATION</title>
                            <sort_order>10</sort_order>
   </hello_children1>
   <hello_children2>
    <title> MACHINE</title>
                            <sort_order>20</sort_order>
   </hello_children2>
   <hello_children3>
    <title> INVOICE</title>
                            <sort_order>30</sort_order>
   </hello_children3>
  </children>
 </helloworld_options>

                    <system>
                        <children>
                            <config>
                                <children>
                                    <helloworld_options translate="label" module="helloworld">
                                        <title> MENU</title>
                                    </helloworld_options>
                                </children>
                            </config>
                        </children>
                    </system>
                </children>
            </admin>
        </resources>
    </acl>
</adminhtml>
Run Code Online (Sandbox Code Playgroud)

这将在后端显示以下菜单和子菜单。此外,这可以在角色资源中配置。:)