I have a custom module that should show a grid in adminhtml with items that can be clicked and edited. adminhtml/routes.xml
<?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="ustorelocator" frontName="ustorelocator">
<module name="Unirgy_StoreLocator" before="Magento_Backend"/>
</route>
</router>
</config>
Action code is:
<?php
namespace Unirgy\StoreLocator\Controller\Adminhtml\Locations;
use Magento\Backend\App\Action;
use Magento\Framework\App\ResponseInterface;
use Magento\Framework\Controller\ResultFactory;
class ListAction extends Action
{
/**
* Dispatch request
*
* @return \Magento\Framework\Controller\ResultInterface|ResponseInterface
* @throws \Magento\Framework\Exception\NotFoundException
*/
public function execute()
{
// TODO: Implement execute() method.
//echo "loaded";
$this->_view->loadLayout();
$resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
// $resultPage->setActiveMenu('Unirgy_StoreLocator::locations');
$resultPage->addBreadcrumb(__('Store Locations'), __('Store Locations'));
$resultPage->addBreadcrumb(__('Manage Store Locations'), __('Manage Store Locations'));
$resultPage->getConfig()->getTitle()->prepend(__('Blog Posts'));
return $resultPage;
//$this->_setActiveMenu("Store Locations");
}
}
Routing works fine, action is executed, but when reaching a line that sets active menu, it dies with fatal error:
Fatal error: Call to a member function setActive() on a non-object in
/app/code/Magento/Backend/Model/View/Result/Page.php on line 60
After some debugging I found that simply backend theme is not being loaded. Anyone have any ideas what I can be missing? I can post the entire error log if needed.