7

I encountered the following issue when i was trying to install a module. When I try to access the admin panel on my magento I get:

Call to a member function setActive() on boolean in C:\xampp\htdocs\project\vendor\magento\module-backend\Model\View\Result\Page.php on line 27

I disabled all third party and custom modules, I compiled the code but I still get this error.

EDIT: I did a var_dump($itemId) just below the line where the error is and the $itemid is 'Magento_Backend::dashboard'.

EDIT 2: The error is because the line "$this->layout->getBlock('menu');" above returns false. I can't find though why this is happening

6

I had the same situation in the development of own modules (I created/changed layout files for grid in adminhtml). Try to clean cache and switch to development mode:

$ ./bin/magento cache:clean
$ ./bin/magento deploy:mode:set developer

I suppose some cached stuff is not cleaned on cache:clean & setup:di:compile in production mode. You can switch back to production mode back if error will gone in development mode.

  • I think I did the same thing! It was a layout file issue. Thanks! – Sotiris Oik Feb 7 '18 at 9:06
  • php bin/magento setup:di:compile - executed this command and resolved my issue – PMB Aug 28 '18 at 10:14
6

I will try to this to solve problem if setActive() error() arrived after setup:di:compile then becauese of session is destroy

so go to Magento directory and then delete file genre ted by di:compile is path :-

magento\generated\metadata\global.php delete this file then after refers your page

this is temporary solution for this error in local server.

  • I already removed it and still not working. – Bhavin Shah Aug 29 '18 at 5:07
  • It actually worked for me, however, is it safe to remove this file? – Greg Dec 8 '18 at 21:00
  • yes it's safe to remove as long as you do a setup:upgrade afterwards – John Jan 21 at 7:27
  • This worked for me. Thanks. – Riddhish Bhayani May 27 at 6:30
2

Do try to remove pub/static and var/cache then run the below commands

php bin/magento setup:upgrade

php bin/magento setup:static-content:deploy

After that it will work

0

When you do getBlock() it returns the block or it returns false if it can not find it. You need to have a check in place something like :

$block = $layout->getBlock('name);
If ($block){
//execute the rest
}

The reason why it can not find your block is something i would need more details for. If you are using a layout xml file be sure that the block and the class of the block does not have any errors.

0

The problem is that the layout xml of this controller path is not loading properly.

Check that the name and the namespace of the controller is matching with the layout file name. Take care of the case sensitivity.

For example:

  • custom_module_admin_customcontroller_action.xml
  • namespace Custom\Module\Controller\Adminhtml\Customcontroller and not CustomController

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.