Hallo,
sorry, my english isn't perfect, may bee, you must smile anytime...
I followed exactly the instructions in the dev docs to create a own module.
This module is succesfull installed and enabled.
Struktur of files in app/code/dfprojects:
In System --> User Roles the entries for the menu are activated:
So can I see this in the adminmenu:
The link from "Eigenanlieferung" is DOMAIN/ADMIN_PSEUDO/dfpea/eigenan/index/key/....
I think, thats correct.
But when you click on "Eigenanlieferung", the Dashboard will appear.
My app/code/dfprojects/module-dfpea/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="dfpea" frontName="dfpea"> <module name="DfProjects_DfpEa" /> </route> </router> </config>
and the app/code/dfprojects/module-dfpea/Controller/Adminhtml/Eigenan/Index.php
<?php namespace DfProjects\DfpEa\Controller\Adminhtml\Eigenan; class Index extends \Magento\Backend\App\Action { /** * @var \Magento\Framework\View\Result\PageFactory */ protected $resultPageFactory; /** * Constructor * * @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; } /** * Load the page defined in view/adminhtml/layout/exampleadminnewpage_helloworld_index.xml * * @return \Magento\Framework\View\Result\Page */ public function execute() { return $resultPage = $this->resultPageFactory->create(); } } ?>
are correctly too, or not?
Why goes the request to Dashboard?
Thanks for reading, a lot of more thanks for a answer.
Greetings George
Solved! Go to Solution.
Hallo @qaisar_satti
a lot of thanks for your response, the solution was changing the foldernames from lower- to uppercase, if the module installed in the app-folder.
vendor-folder dfprojects to DfProjects and module-folder dfpea to DfpEa
<?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="dfpea" frontName="dfpea"> <module name="DfProjects_DfpEa" /> </route> </router> </config>
change to
<?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="dfpea" frontName="dfpea"> <module name="DfProjects_DfpEa" before="Magento_Backend" /> </route> </router> </config>
Hallo @qaisar_satti
a lot of thanks for your response, the solution was changing the foldernames from lower- to uppercase, if the module installed in the app-folder.
vendor-folder dfprojects to DfProjects and module-folder dfpea to DfpEa
Hi,
I think that there are 2 causes that lead to your problem:
– The code of the route file is not correct
– It lacks the menu.xml file in the etc/adminhtml
Therefore, you must:
- Editing the app/code/dfprojects/module-dfpea/etc/adminhtml/routes.xml file
- Creating the file app/code/dfprojects/module-dfpea/etc/adminhtml/menu.xml
Read the detailed solution to your issue at: Fix Magento 2 Error Related To Custom Link in Admin Menu
Hi @tigren_solution,
My question has been back for some time, but for a long time I did not get an answer.
Therefore, I studied countless tutorials, de-installed and reinstalled my module.
The already made change of the routes.xml alone did not succeed.
Also the creation of the menu.xml in the module structure did not help, but in my experience does not necessarily have to be done in this module. If you have several own modules, they can stand in any one. So you have a central point for the menu entries of all your own modules, in my project DfProjects -> Backend.
As already written above, the link only worked flawlessly when I wrote the first letter of my vendor directory in mag_root -> app -> code (DfProjects) and the module (DfpEa) large. In mag_root -> vendor the directories can all start with small letters. Why is that?
Thanks for your blog, maybe you give there also the reference to the upper and lower case.
Best regards
Hi,
I have re-checked your issue again, I think that we just need to make a little change as the following:
<module name="DfProjects_DfpEa" />
changing to:
<module name="DfProjects_Dfpea" />
Have you tried doing this?
Hi @tigren_solution,
we seem to misunderstand, the module runs smoothly for 2 months.
The solution for me was changing the spelling of the folder names.
I thank you anyway for your efforts!
Greetings George