This is an interesting problem here.
Basically the problem is that the
getAction method declared in
Mage_Core_Block_Abstract is definitely what you need to use here and your code is definitely right.
It is supposed to return a
Mage_Core_Controller_Varien_Action that you can use to get the full action name.
Mage_Review_Block_Form block entirely rewrites the
getAction method with the following code:
public function getAction()
$productId = Mage::app()->getRequest()->getParam('id', false);
return Mage::getUrl('review/product/post', array('id' => $productId, '_secure' => $this->_isSecure()));
That code returns a string so you cannot call the
getFullActionName method on it, that's the problem.
I'm not sure why the Magento team did use the same name as such an important function of the parent block, sounds like a bug to me.
What you can do avoid that is:
Either use the following code instead:
Or if you want to do things for a specific block and not every block created, add a condition to test the block class:
if ($block instanceof The_Block_You_Want)
if (($block->getAction()->getFullActionName() == 'catalog_product_view') && ($block->getNameInLayout() == 'product.info'))
Of course that won't work if the block you want to test is the
On a side note, please note that the following block also rewrite the
Mage_Customer_Block_Newsletter (and it also returns a string)