0

I need to make new admin page with a grid, in M2, and along with it, a menu link that will link to it. I have made a menu item successfully, and it looks like it is linked to correct URL, but when I click on it, I am just redirected to admin index page. What am I missing here? My Namespace/Modulename/etc/acl.xml is:

<?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="Namespace_Modulename::griglia" title="Modulename Griglia" sortOrder="51">
                    <resource id="Namespace_Modulename::griglia_child_resource" title="Grigla Child Resource" sortOrder="10"/>
                </resource>
            </resource>
        </resources>
    </acl>
</config>

My etc/adminhtml/menu.xml is:

<?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="Namespace_Modulename::index" title="Modulename" module="Namespace_Modulename" sortOrder="51" resource="Namespace_Modulename::index"/>
        <add id="Namespace_Modulename::griglia" title="Griglia" module="Namespace_Modulename" sortOrder="10" action="modulename/griglia" resource="Namespace_Modulename::griglia" parent="Namespace_Modulename::index"/>
    </menu>
</config>

My etc/adminhtml/routes.xml is:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/App/etc/routes.xsd">
    <router id="admin"> <!-- This part is different from frontend -->
        <route id="modulename" frontName="modulename">
            <module name="Namespace_Modulename" />
        </route>
    </router>
</config> 
8
  • 1
    have u add routes.xml?
    – Jackson
    Commented Mar 28, 2017 at 8:39
  • 1
    you should also add here your routes xml and menu xml at least. Maybe list your controllers as well Commented Mar 28, 2017 at 8:43
  • Ok, I didn't add routes.xml. Will do and update the question. menu.xml is added. Commented Mar 28, 2017 at 9:00
  • 1
    do you check request get in controller? Commented Mar 28, 2017 at 10:10
  • 1
    There is a form? Can you post your controller? Commented Mar 28, 2017 at 13:28

1 Answer 1

0

I got the out put, by putting "HARDCODED TEXT" in execute and return; . I want to have my custom template however. Will post in another question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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