When I added a region in my custom theme, a subtheme of Seven, the region assignment of my blocks all broke.

I added one region to the .info and page.tpl.php files I believe correctly, and when I cleared my cache, I got the following messages.

The block foo1 was assigned to the invalid region content and has been disabled.
The block foo2 was assigned to the invalid region help and has been disabled.

I was able to copy all the regions from the Seven parent theme to my subtheme .info file and then add my additional region, but is this doesn't seem like the way it was designed. If this is a bug, where should I file it since seven is part of core, and this page doesn't seem appropriate? https://drupal.org/project/seven


VM’s picture

see: https://drupal.org/node/171205#regions

It sounds as if your subtheme.info file didn't have any regions defined from the onset? The moment you added a custom region the defaults were no longer carried over from the parent.

Jeff Burnz’s picture


And while you are only obligated to include the content region all themes should declare at least 3:

regions[content] = Content
regions[page_top] = Page top
regions[page_bottom] = Page bottom

In a sub theme you must declare all the regions again, even if you are only adding one. If you declare none Drupal will assume you mean all the defaults and disable any blocks for regions that don't match - thats when you get the warnings about invalid regions. My guess is this process did not go smoothly for you, maybe you added the regions after you visited the blocks page and have not yet cleared the sites cache to update your subthemes info file.

j1ndustry’s picture

Thank you for clearing up my confusion. I see now that a parent theme's regions are only used if you don't declare any regions in the subtheme. If you declare any regions in a subtheme, you must delcare all the regions in the subtheme.

" If you override regions in D7, you are obliged to declare the line regions[content] = Content. If you want any of the default regions in your theme, you have to declare them as well." https://drupal.org/node/171205#regions