Deactivate layout update with module deactivation in magento -
i'm programming magento module. i've been wondering, how deactivate layout updates of module, deactivating module. wan't deliver possibility recover changes done module if it's inactive.
here's config.xml:
<?xml version="1.0" encoding="utf-8"?> <config> <modules> <bss_tierpreis> <version>0.0.5</version> </bss_tierpreis> </modules> <global> <models> <tierpreis> <class>bss_tierpreis_model</class> </tierpreis> </models> <blocks> <tierpreis> <class>bss_tierpreis_block</class> </tierpreis> </blocks> </global> <frontend> <layout> <updates> <tierpreis> <file>tierpreis.xml</file> </tierpreis> </updates> </layout> </frontend> </config>
tierpreis.xml:
<?xml version="1.0"?> <layout version="0.1.0"> <catalog_product_view> <reference name="head"> <action method="addcss"> <name>css/tierpreis.css</name> </action> </reference> <reference name="content"> <reference name="alert.urls"> <block type="tierpreis/getlist" name="tierpreis_getlist" template="tierpreis/list.phtml" /> </reference> </reference> </catalog_product_view> </layout>
it's annoying css file loaded while module not active. there way avoid it?
you can use ifconfig parameter
<reference name="head"> <action method="settemplate" ifconfig="module/general/enabled"> <template>route/to/template</template> </action> </reference>
you need set 1 dropdown module enable/disable in yourmodule in admin panel , set value "0" => "no" save , add path in layout file ifconfig parameter.
Comments
Post a Comment