I want to get and modify the Mage_Adminhtml_Block_Sales_Order_Grid
block from within an observer which is listening for the event resource_get_tablename
.
In my observer I'm using the code
if($observer->getTableName() == 'sales_flat_order_grid') {
$block = Mage::getBlockSingleton('Sales_Order_Grid');
}
Whilst this does get an instance of Sales_Order_Grid
its not the one that has already been instantiated by the system.
I added some logging to the constructor of Mage_Adminhtml_Block_Sales_Order_Grid
and I can see that its called twice. I hadn't expected this behaviour as the word Singleton, in the getBlockSingleton
method, to me implies that there will be only one instance stored in the registry.