0

If you are declaring your router in etc/adminhtml/routes.xml with similar way

<?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="myModule" frontName="myModule">
            <module name="My_Module" before="Magento_Backend"/>
        </route>
    </router>
</config>

it doesn't work. In my case my base url will be /admin/myModule/index/index.

I was pushed to replace myModule with my_module (in URL in XML, at least in frontName attribute, and rename layout/handle filename).

0

It's enough to keep layout/handle file in lower case.

E.g. we have request:

myModule/someController/massUpdate

Handle filename should be in lower case:

mymodule_somecontroller_massupdate.xml

So, there is some debug experience:

Method \Magento\Framework\View\Result\Layout::getDefaultLayoutHandle() has converting to lowercase:

/**
 * Retrieve the default layout handle name for the current action
 *
 * @return string
 */
public function getDefaultLayoutHandle()
{
    return strtolower($this->request->getFullActionName());
}

and there xpath request for the handle node:

\Magento\Framework\View\Model\Layout\Merge::_fetchPackageLayoutUpdates

foreach ($layout->xpath("*[self::handle or self::layout][@id='{$handle}']") as $updateXml) {
        //...
    }

and it looks like it's case-sensitive.

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.