class Mycompany_Mymodule_Block_Adminhtml_ProductList extends Mage_Adminhtml_Block_Widget_Grid_Container { public function __construct() { $this->_blockGroup = 'mycompany_mymodule'; $this->_controller = 'adminhtml_productList'; $$this->_headerText = Mage::helper('mycompany_mymodule')->__('Product List'); parent::__construct(); } protected function _prepareLayout() { $this->setChild('grid', $this->getLayout()->createBlock('mycompany_mymodule/adminhtml_productList_grid', 'mygrid')); return parent::_prepareLayout(); } }
This example adds a custom widget to the order view page in the backend of Magento. It uses the `reference` tag to reference the `order_info` block on the page, and defines a new block using the `type` attribute to specify the widget's class. It sets a unique name for the block using the `name` attribute and specifies the template file for the widget using the `template` attribute.