I'm using below code in adminhtml/menu.xml to show menu/sub-menu in admin. I'm able to see menu Lapisbard
in admin but sub-menu Store Locations
is not visible when I click on menu named Lapisbard.
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Backend/etc/menu.xsd">
<menu>
<add id="lapisbard::base" title="Lapisbard" module="Lapisbard_StoreLocator" sortOrder="90" resource="Lapisbard_StoreLocator::storelocator" />
<add id="lapisbard_storelocator::locations" title="Store Locations" module="Lapisbard_StoreLocator" sortOrder="10" parent="lapisbard::base" action="lapisbard_storelocator/locations/" resource="Lapisbard_StoreLocator::locations"/>
</menu>
</config>
If I'm adding it in content section using parent="Magento_Backend::content"
it's working fine there.
<menu>
<add id="Lapisbard_StoreLocator::storelocator" title="Lapisbard" module="Lapisbard_StoreLocator" sortOrder="90" parent="Magento_Backend::content" resource="Lapisbard_StoreLocator::storelocator" />
<add id="Lapisbard_StoreLocator::locations" title="Store Locations" module="Lapisbard_StoreLocator" sortOrder="10" parent="Lapisbard_StoreLocator::storelocator" action="blog/post" resource="Lapisbard_StoreLocator::locations"/>
</menu>
Best Answer
I think you're missing the acl here.
and acl like:
Basically, your problem lies in the permissions. If you inherit it from Backend, you are using the Backend's permissions, and you are fine. But if you want to have submenu, you need your own acl.