I try to write a own module. After 1 week of searching I hope u can help to go on.
Its a very simple admin page.
module_dir: app/code/famberg/module_afterbuysync/
… Controller/Adminhtml/Settings/Index.php:
<?php
namespace FambergAfterbuySyncControllerAdminhtmlSettings;
use MagentoBackendAppActionAction;
use MagentoBackendAppActionContext;
use MagentoFrameworkAppActionHttpGetActionInterface;
use MagentoFrameworkViewResultPage;
use MagentoFrameworkViewResultPageFactory;
class Index extends Action implements HttpGetActionInterface
{
const MENU_ID ="Famberg_AfterbuySync::settings";
protected $_pageFactory;
public function __construct(
Context $context,
PageFactory $pageFactory)
{
parent::__construct($context);
$this->_pageFactory = $pageFactory;
}
public function execute()
{
$resultPage = $this->_pageFactory->create();
$resultPage->setActiveMenu(static::MENU_ID);
$resultPage->getConfig()->getTitle()->prepend(__('AfterbuySync Settings'));
return $resultPage;
}
}
?>
…/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Famberg_AfterbuySync" setup_version="1.0.5">
</module>
</config>
…/etc/adminhtml/routes.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="admin">
<route id="afterbuysync" frontName="afterbuysync">
<module name="Famberg_AfterbuySync" before="Magento_Backend" />
</route>
</router>
</config>
…/registration.php
<?php
use MagentoFrameworkComponentComponentRegistrar;
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Famberg_AfterbuySync', __DIR__);
Everytime i get the message
Invalid security or form key. Please refresh the page.
After xdebuging I see that the controller class is not loaded. The module is loaded. The menu item is shown. I dont know why the controller class does not exists.
Please help.
Michael