mitic
mitic

Reputation: 1

overriding adminhtml block template in community pool

Is it possible to override template located here /app/design/adminhtml/default/default/template/ (e.g. /app/design/adminhtml/default/default/template/customer/edit/js.phtml) by creating a new module in community pool?

So the thing is that I don't want to override it by placing the file (or anything) in local pool.

Is it possible to do that by extending of appropriate block class or something like that?

I've created the same file in /app/design/adminhtml/default/my_directory/template/ and extended Mage_Adminhtml_Block_Customer_Edit class in /app/code/community/MyCompany/MyModule/Block/Adminhtml/Customer/Edit.php and don't have an idea of how to solve this.

Upvotes: 0

Views: 752

Answers (1)

clockworkgeek
clockworkgeek

Reputation: 37700

In your modules' config (app/code/community/MyCompany/MyModule/etc/config.xml) add the following section:

<adminhtml>
    <layout>
        <updates>
            <mycompany_mymodule>
                <file>mycompany_mymodule.xml</file>
            </mycompany_mymodule>
        </updates>
    </layout>
</adminhtml>

This will make mage look for a new file in app/design/adminhtml/default/layout/mycompany_mymodule.xml which should look something like this:

<?xml version="1.0"?>
<layout>
    <adminhtml_customer_edit>
        <reference name="customer.edit.js">
            <action method="setTemplate">
                <template>mydirectory/edit/js.phtml</template>
            </action>
        </reference>
    </adminhtml_customer_edit>
</layout>

And then work on your file app/design/adminhtml/default/template/mydirectory/edit/js.phtml. There is probably no need to replace/extend the current block because it is already doing a good job as it is.

Upvotes: 1

Related Questions