Can I create a widget instance and assign it to a specific page to appear through install script? I'd like to have some functionality similar to sample contents, but with widgets. To be more specific, my question is aimed at creating instances of widgets and placing them on certain pages programmatically through install script.
Creating and Placing a Widget Through Install Script in Magento
-setupcmsinstallscriptwidget
Best Answer
Its not pretty, but of course you can create a widget instance programmatically, for example in a setup script:
This example sets the widget instance to display on every page in the left column.
If you want to specify different pages or target blocks, you need to update the values accordingly. I suggest looking what is set in
Mage_Widget_Adminhtml_Widget_InstanceController::saveAction()
and adjust the code above accordingly.