3

I'm open-sourcing a custom drupal theme, and I'm looking to provide a good out-of-the-box experience to those who use it. However, when the theme is enabled for the first time, many of the default drupal blocks (search, user login, "powered by drupal," etc.) are all jammed in the first block-region (pre-header), which pushes everything down and makes the page look broken.

I'd like to do one of the following things:

  1. Unassign all blocks by default for the theme, to give users a clean slate
  2. Pre-position the blocks into more appropriate regions

I don't want to do it in an install profile or a module, to keep things simple for end-users. Any ideas?

1

2 Answers 2

3

You can't control this from the theme at the time it's being enabled.

Drupal will try to assign each block enabled for the default theme to the same region in your theme, if available. If there's no region with a coincident name, it will drop the block to the default region, that is the first region defined in your theme's .info.

So there're two things you can do:

  • use more standard region names (sidebar_first, sidebar_second, footer)
  • in theme's .info, declare in the first place the more suitable region for orphaned blocks
0

Features extra is a module that extends features, which allows you to export block settings, including region. You mentioned you don't want to accomplish this in a module which is essentially what Features generates, but hopefully this answer is helpful to others who run across your question searching.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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