I was trying to add a block to the head in magento backend for a specific controller action.
public function updateAction(){
$block = $this->getLayout()->createBlock(
'Mage_Core_Block_Template',
'namespace_update_form_head_data',
array(
'template' => 'namespace/update/head/data.phtml'
)
);
/**
* @var Mage_Adminhtml_Block_Page_Head
*/
$head =$this->getLayout()->getBlock('head');
$head->append($block);
}
However nothing is output in the head
If I use getBlock('content')
or getBlock('js')
instead of getBlock('head')
for example it works fine but outputs the text at the content area as expected or at the end of body.
If I try $head->addCss()
or $head->addJs()
they both work fine too and I can add specific js or css files but I can't append a block template.
Could anyone explain to me why it's not loading the block and how to properly load it if possible?
Thanks in advance