3

I'm building an extension, following the official Magento developer's guide, here: http://info.magento.com/rs/magentocommerce/images/Magento-Extension-Developers-Guide-v1.0.pdf

In the app/etc/modules/Mage_Extension.xml file, the following code results in a fatal error:

<config>
    <modules>
        <Mage_Extension>
            <active>true</active>
            <codePool>community</codePool>
            <depends>
                <Mage_adminhtml />
            </depends>
        </Mage_Extension>
    </modules>
</config>

However, this is stipulated as a recommendation by Magento on page 8 of the guide. If I comment out the depends code, all is well:

<config>
    <modules>
        <Mage_Extension>
            <active>true</active>
            <codePool>community</codePool>
            <!--
            <depends>
                <Mage_adminhtml />
            </depends>
            -->
        </Mage_Extension>
    </modules>
</config>

Can anyone tell me why this throws an exception and whether I should just leave it out?

Thanks.

  • 1
    If you don't overwrite magento class and your magento extension don't depends on any extension then just leave it out – Mufaddal Jun 5 '13 at 9:29
  • If your module uses any functionality from Mage_Adminhtml it is best pratice to set it as a depencency. Adminhtml will be there, but other modules like Mage_Poll might be deactivated. – Fabian Blechschmidt Jun 5 '13 at 12:15
8

The error comes from the fact that adminhtml is all lowercase.
It should be:

<depends>
   <Mage_Adminhtml />
</depends>

Off topic: I hope Mage_Extension is just a placeholder you used for the extension name in this question. Do not use Mage as a namespace. Even if it works is not a good practice.

| improve this answer | |
  • Fantastic, thx Marius. Yes, it's just a placeholder ;) – Jongosi Jun 5 '13 at 13:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.