1

I've setup a etc/adminhtml/routes.xml for my module with the following code.

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <router name="admin">
        <route id="blog" frontName="blog">
            <module name="Vendor_Blog" before="Magento_Backend" />
        </route>
    </router>
</config>

Which causes the following error in var/report whenever I try to access the admin panel;

Notice: Trying to get property of non-object in /vagrant/public/lib/internal/Magento/Framework/App/Route/Config/Converter.php on line 51"

How do I fix this?

1

Not test properly yet. But your admin xml is wrong.

1) Missing Schema Validation:

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
    ......
</config>

2) Element router, attribute name: The attribute name is not allowed.

<router name="admin"> => need to change to <router id="admin">.

So, your route should be:

<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd>
    <router id="admin">
        <route id="blog" frontName="blog">
            <module name="Vendor_Blog" before="Magento_Backend" />
        </route>
    </router>
</config>
  • I believe the <router id="admin"> was throwing the error. Thanks! – ol'bob dole Dec 3 '17 at 13:50

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.