I am on a Omega 960 theme and could not find the search block.

I found it is being assigned to a region that does not exist as posted here.
http://drupal.org/node/992208#comment-3809758

Comments

jhodgdon’s picture

Title: Search block not in blocks list » Blocks vanish from blocks list when theme is switched and regions don't exist
Version: 7.0 » 7.x-dev
Component: search.module » block.module
Priority: Normal » Major

That is not really an issue in the search.module, but an issue in the block.module -- that if you move to a theme that is lacking regions where a block has been assigned, the block vanishes from the blocks admin page.

jhodgdon’s picture

Issue tags: -core search

tag not necessary

dcrocks’s picture

Pretty sure this is similar to http://drupal.org/node/1103590.

jhodgdon’s picture

Seems like they are related, but 1103590 is talking about "hidden" regions, and this issue is talking about regions that don't even exist in the new theme, unless I am mistaken?

dcrocks’s picture

I think it is still the same piece of code, function block_theme_initialize($theme), in the block module. When a theme is 1st enabled, blocks are set up to mimic whatever is the block configuration of the current 'default' theme. If the blocks region(from default theme) doesn't exist in the new theme it is supposed to be mapped to the 'default region' of the new theme, which appears to be the 1st region listed in the new theme .info file. 'dashboard_sidebar' is a region defined in the dashboard module and I have no idea how it got to be $region(0) when function system_default_region($theme) was called. Maybe caching? The dashboard regions are defined in the database for the 'seven' theme, the default admin theme, but 'dashboard_system_info_alter' in dashboard.module implies these regions are added on the fly to all themes when the dashboard is active, though they should be added to the end. Sorry, I'm reading code as I write here. I still think the fix goes in function block_theme_initialize($theme) but maybe function system_default_region($theme) is where the fix is needed. Was this a theme that was enabled, disabled, and then enabled again?

dcrocks’s picture

Is it possible that 'seven' was the default theme when this occurred? Or that a theme used as an admin theme was the default theme when the new theme was enabled?

dcrocks’s picture

Experiment shows that if you make a theme the admin theme and you open the dashboard form from the toolbar, then the dashboard.module's regions are added to that theme's block definitions in the database, apparently permanently. If I understand correctly, disabling a theme and then enabling it again does not clear those definitions, as verified by experiment. So more info as how to repeat the error would help.

jhodgdon’s picture

Right, I'm sure they're related, but they are not exactly the same issue. Ideally the solution would fix them both.

dcrocks’s picture

I did confirm on a new install of the latest 7.x dev that 'seven' has the dashboard regions assigned to it. This must be done during install. If the 'mystery' region that blocks are being assigned to is 'dashboard-sidebar' then either 'seven' was the default theme when the new theme was enabled or the default theme had also been set as the admin theme and the dashboard form was opened while that theme was the admin theme.
Implication is that system_region_list shouldn't return the dashboard regions, at least when a new theme is being enabled.

sun’s picture

Version: 7.x-dev » 8.x-dev
Issue tags: +Needs backport to D7
Bojhan’s picture

How is this a major issue?

dcrocks’s picture

Does this need to be fixed? This really requires a special set of circumstances to happen. And it is recoverable by going to structure/blocks/configure in a theme where the block is visible and choosing the drop down for the theme where the block is invisible and changing it. What I am asking, is it necessary to add code to test for a case that is rare, doesn't break the site, and is recoverable thru the admin menus?

Bojhan’s picture

Priority: Major » Normal

This is not a big bug.

benjy’s picture

Version: 8.x-dev » 7.x-dev
Issue summary: View changes

This is no longer an issue in D8. Blocks that are assigned to undefined regions fall into the first defined region of the new theme.