0

I am trying to add test menu item in admin menu in magento 2, like it is described here: Adding a Menu to the Left Side but menu item is not showing. What I miss or doing wrong ? Extension is enabled, cache disabled, commands executed:

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy

/app/code/Rockforweb/Stuller/etc/adminhtml/menu.xml:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
    <menu>
        <add id="Rockforweb_Stuller::top_level_example"
             title="Top Level Example"
             module="Rockforweb_Stuller"
             sortOrder="9999"
             resource="Magento_Backend::content"
            />
    </menu>
</config>
1

I'd imagine that you have forgotten to add the etc/acl.xml file

If should look something like this :

<?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
        <acl>
            <resources>
                <resource id="Magento_Backend::admin">
                    <resource id="Rockforweb_Stuller::top_level_example" title="Your title" translate="title" />
                </resource>
            </resources>
        </acl>
    </config>

You would then need to change resource="Magento_Backend::content" to resource="Rockforweb_Stuller::top_level_example"

Run bin/magento setup:upgrade, logout and log back in again

  • Hello, thank you for answer. Unfortunatelly menu is not showing. When i run upgrade command i receive error from another extension: >> Incorrect dependency in class ... << maybe menu is not showing due to this error ? – John Oct 11 '17 at 19:03
  • you were right about acl.xml file....i didnt have it...now i have in etc/ folder – John Oct 11 '17 at 19:17
  • Sounds like a different error unrelated toy our xml. Have you got a di.xml file you could share ? I would also update your question with the full error message. – Frank Oct 12 '17 at 8:08
0

Please try the below code and run the setup upgrade and deploy commands.

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
<menu>
<add id="Rockforweb_Stuller::top_level_example" title="Top Level Example" module="Rockforweb_Stuller" sortOrder="9999"          resource="Rockforweb_Stuller::top_level_example" />
</menu>
</config>
  • Hi, thank you for answer. Unfortunatelly it's not helps. Maybe because i don't have ACL ? or maybe i don't have recource model mentioned in your answer >>resource="Rockforweb_Stuller::top_level_example"<< – John Oct 11 '17 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.