What causes a block to be false after instantiating (and not an object) in Magento?

subzerohimself

New Member
I've been working on getting a new form in the adminhtml for my Magento module. I'm running into a serious issue with actually loading blocks, however. I can load a test block (using a phtml layout) using this code I found in a different stack overflow question (I implement this in the adminhtml controller):\[code\] $block = $this->getLayout()->createBlock('coupsmart_coupon/adminhtml_forms'); error_log('The block:' . var_export($block, true)); if($block) { $block->setTemplate('test/test.phtml'); error_log(var_export($block->getTemplate(), true)); error_log('The HTML:'); error_log(var_export($block->toHtml(),true)); }\[/code\]Using a test block, I get back the correct html (found in my adminhtml/default/default/template folder).However, when I instantiate a grid_container block, it it doesn't run the \[code\]if($block){}\[/code\] portion, because the block is false. But in my block class for the grid_container, I have a \[code\]__constructor()\[/code\] method where I log an output, so it is running the constructor, which means my class instantiation (and naming) is correct. What can cause a constructor to run on a block but have it still return false, for an \[code\]Mage_Adminhtml_Block_Widget_Grid_Container\[/code\] class?If any more code is needed (controller, grid_container block, grid block, config, etc.) is needed, let me know, and I'll post it up. I just didn't want to overwhelm with a code overflow that may dilute the question.EDIT: Grid Container\[code\]class Coupsmart_Coupon_Block_Adminhtml_Forms extendsMage_Adminhtml_Block_Widget_Grid_Container{ public function __construct() { error_log('adminhtml forms (parent) construct'); $this->_controller = 'adminhtml_forms'; $this->_blockGroup = 'coupsmart_coupon'; $this->_headerText = Mage::helper('forms')->__('Coupon Manager'); $this->_addButtonLabel = Mage::helper('forms')->__('Edit Coupon'); parent::__construct(); }}\[/code\]The error log in the container above shows up when I instantiate the block.
 
Back
Top