Here’s a bit of code I used while developing a custom module for a client’s shop. The module allows a Flash application to launch popups of any given product. There was a module the client definitely wanted to keep but that was interfering with my ability to close the popup when the client clicked the ‘Add to Cart’ button – and we didn’t need that module working within the popup iframe. I googled for a while but there was no documentation on how to do this.
So here’s what I did to disable that module and its output. It might not be the best solution but it worked nicely and I didn’t have to manually remove each item in my module’s layout file:
- I already had a controller, so I added the following protected function:
// Disable the module itself
// Disable its output as well (which was already loaded)
- and called it in my action before loading the layout:
A better solution might be to hook at an earlier moment, preferably before module layouts are loaded, but I didn’t have enough time to research on that possibility.