I’veÂ decided that I hate Wordpress’ multi-widget “API”, so I’ve written a cleaner interface for it: class MultiWidget
Damon Timm added multi-widget functionality to Event-Calendar. He did a fine job, but I was horrified by the hoops he’d been forced to jump through.Â The barely-documented “API”Â is so horrible and crufty that I simply don’tÂ trust that it will remain in future versions of Wordpress. I fear that in aÂ few months time, the multi-widget hacks inside wp-admin will change orÂ disappear, and we’d be scrambling to play catch up.
I was all but ready to give up and reluctantly decide against multi-widgets,Â but then I thought of a better plan…
I’ve taken the example multi-widget code and turned it into an abstract classÂ with a clean interface: class MultiWidget. This class isÂ useless on its own – you have to extend the class to make a customÂ multi-widget – e.g. classÂ ExampleMultiWidget.
The classÂ ExampleMultiWidgetÂ is quite clean, and doesn’t contain any of theÂ crufty secret multi-widget knowledge. I’m hoping that if/when “they” changeÂ the multi-widget API, I’ll just be able to take the new example, and translateÂ it into a new version of the interface class MultiWidget, but without havingÂ to change any of the derived classes.