AD0-E724 · Question #32
When building a new Admin page, a developer must create a menu item so that users can access it. In which module configuration file should the new Admin menu item be declared?
The correct answer is A. 'etc/adminhtml/menu.xml'. In Magento 2, etc/adminhtml/menu.xml is the dedicated configuration file for declaring Admin panel menu items - it defines the menu tree, labels, sort order, and ACL resource mappings that control navigation in the backend. etc/adminhtml/di.xml handles dependency injection config
Question
When building a new Admin page, a developer must create a menu item so that users can access it. In which module configuration file should the new Admin menu item be declared?
Options
- A'etc/adminhtml/menu.xml'
- B'etc/adminhtml/di.xml'
- C'etc/adminhtml/routes.xml'
- D'etc/config.xml'
How the community answered
(17 responses)- A82% (14)
- B12% (2)
- D6% (1)
Explanation
In Magento 2, etc/adminhtml/menu.xml is the dedicated configuration file for declaring Admin panel menu items - it defines the menu tree, labels, sort order, and ACL resource mappings that control navigation in the backend. etc/adminhtml/di.xml handles dependency injection configuration and is unrelated to menu structure. etc/adminhtml/routes.xml registers URL routes for the Admin area but does not render or declare menu entries. etc/config.xml stores default system configuration values (for the Stores > Configuration section), not navigation menus.
Memory tip: Think "menu goes in menu.xml" - the filename is self-documenting. If you remember that Magento uses purpose-named XML files (routes.xml for routes, di.xml for DI, menu.xml for menus), the adminhtml/ subdirectory just tells you it applies to the backend scope.
Topics
Community Discussion
No community discussion yet for this question.