adminhtml.xml in details

adminhtml.xml in details

At the beginning there was config.xml. It contain module configuration information for all “areas”, like frontend, adminhtml, global etc. Since magento does consist of a lot of modules resulting configuration object has rather big size. To reduce its size and speed up frontend developers decide to separate admin information from config.xml. adminhtml.xml was presented in magento 1.4. It contain nodes for access control lists ( ACL ) and admin menu items. Use of adminhtml.xml is optional. You could store acl / menu info in config.xml

adminhtml.xml nodes

1. Admin menu items

<title /> – item text
<action /> – item route ( URL )
<sort_order /> – item position in admin menu
<children /> – item children ( submenu )

2. Access control lists

As you can see it use same hierarchical pattern as menu node.

What about other adminhtml nodes?

adminhtml.xml loaded in app/code/core/Mage/Admin/Model/Config.php

But it use only acl and menu nodes.

Not sure why but other nodes still kept in config.xml. So if your module use events, you want to add translate file or declare layout update for admin – you need to use config.xml

Summary

Use adminhtml.xml to store module ACL and menu nodes. It makes your main config file more readable. You can still use config.xml for that purpose, but it might be removed in future releases. So keep in mind that adminhtml node in config.xml could be just for backwards compatibility.

Leave a Reply

Your email address will not be published. Required fields are marked *