I have succesfully added a new admin menu. But the problem is whenever i clicked the admin menu button, I got Invalid security or form key. Please refresh the page.
Here're some of my codes.
This is my menu.xml
<add id="Testing_Basic::menu_item" title="Manage Items" module="Testing_Basic" sortOrder="10" parent="Testing_Basic::menu" action="Webpage/Create/Index" resource="Testing_Basic::menu_item"/>
And this is my directories looks like.
This is my
Controller/Adminhtml/Webpage/Index.php
<?php
/**
* Webkul Grid Controller
*
* @category Webkul
* @package Webkul_Grid
* @author Webkul Software Private Limited
*
*/
namespace Testing\Basic\Controller\Adminhtml\Webpage;
class Index extends \Magento\Backend\App\Action
{
/**
* @var \Magento\Framework\View\Result\PageFactory
*/
protected $_resultPageFactory;
/**
* @param \Magento\Backend\App\Action\Context $context
* @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
*/
public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magento\Framework\View\Result\PageFactory $resultPageFactory
)
{
parent::__construct($context);
$this->_resultPageFactory = $resultPageFactory;
}
/**
* Grid List page.
*
* @return \Magento\Backend\Model\View\Result\Page
*/
public function execute()
{
/** @var \Magento\Backend\Model\View\Result\Page $resultPage */
$resultPage = $this->_resultPageFactory->create();
$resultPage->setActiveMenu('Testing_Basic::grid_list');
$resultPage->getConfig()->getTitle()->prepend(__('Grid List'));
return $resultPage;
}
/**
* Check Grid List Permission.
*
* @return bool
*/
protected function _isAllowed()
{
return $this->_authorization->isAllowed('Testing_Basic::grid_list');
}
}
And this is my routes.xml
<?xml version="1.0"?>
<!--
/**
* Webkul_Grid route xml
*
* @category Webkul
* @package Webkul_Grid
* @author Webkul Software Private Limited
*
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="admin">
<route id="create" frontName="create">
<module name="Testing_Basic" />
</route>
</router>
</config>