I accidentally remove the core/system blocks that normally sit under the content region and now I am not able to access any of the administration page.

If I visit my site/user/login, or register, etc, it shows me everything as per the markup I created

Is there a way I can re-add those blocks to the content region without being logged in? Any database query, drush command or drupal console?

  • If your site is managed via configuration management you could do drush cim. Or navigate to example.com/admin/structure/block and put them back. I don't understand what this means: it shows me everything as per the markup I created. – leymannx Apr 14 '20 at 13:13
  • 4
    Making sure you're running in a dev/test environment (you don't want to test anything on a prod site for obvious reasons), try drush theme:uninstall seven; drush theme:enable seven. Disabling and enabling themes sometimes (always?) has the effect of resetting the block layouts to default in my experience – Clive Apr 14 '20 at 13:35
  • @clive your suggestion worked. Using drush I managed to activate seven: drush theme:enable seven and finally drush config-set system.theme default seven. Also I ended up noticing that the region showing the content was wrapped in an if statement which would never be truthful for pages that aren't a node. :( – user agent Apr 14 '20 at 14:04
  • 2
    Ouch. I'd be git blameing that one straight away... – Clive Apr 14 '20 at 14:07

Your Answer

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

Browse other questions tagged or ask your own question.