Skip to content

Instantly share code, notes, and snippets.

@birchestx
Created December 27, 2013 07:19
Show Gist options
  • Save birchestx/8143673 to your computer and use it in GitHub Desktop.
Save birchestx/8143673 to your computer and use it in GitHub Desktop.
In config.xml
<controller_action_layout_generate_xml_before>
<observers>
<add_new_layout>
<class>wsafreightcommon/observer</class>
<method>addNewLayout</method>
</add_new_layout>
</observers>
</controller_action_layout_generate_xml_before>
Observer.php
public function addNewLayout($observer){
$layout = $observer->getEvent()->getLayout();
$update = $layout->getUpdate();
$action = $observer->getEvent()->getAction();
$fullActionName = $action->getFullActionName();
switch ($fullActionName) {
case 'adminhtml_sales_order_view':
$xml = "<reference name='root'><remove name='footer'></remove></reference>";
$update->addUpdate($xml);
...
break;
}
//in case you're going to add some conditional (apply these new layout xml on these action or other things, you can modify it by yourself)
//here is the pieces of layout xml you're going to load (you get it from database)
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment