0

I am getting error like below

Recoverable Error: Argument 1 passed to Mage_Adminhtml_Controller_Action::_addContent() must be an instance of Mage_Core_Block_Abstract, boolean given,

My indexAction code is like below

public function indexAction()
    {
        // instantiate the grid container
        $brandBlock = $this->getLayout()
            ->createBlock('digitech_brandlogo_adminhtml/brandlogo');

        // Add the grid container as the only item on this page
        $this->loadLayout()
            ->_addContent($brandBlock)
            ->renderLayout();
    }

In this case my Question is What does it mean by "

$brandBlock = $this->getLayout()
                ->createBlock('digitech_brandlogo_adminhtml/brandlogo');

" ??

I would like to know about block and layout structure/arrangement for this.

0

$this->getLayout() basically call current page layouts and createBlock create block() at in current page.

But in your code,you have try to call a block before load layout $this->loadLayout().So you should call layout first the add block in layout

/* first load layout */
$this->loadLayout();
/*then inject bloack at page */
 $brandBlock = $this->getLayout()
    ->createBlock('digitech_brandlogo_adminhtml/brandlogo');
/* using    _addContent add this block at content area */
   $this->_addContent($brandBlock)
    ->renderLayout();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.