This project is not covered by Drupal’s security advisory policy.

The Per-Theme Blocks module allows themes developers to suggest blocks information to the site administrator.

This is especially helpful to manage several sites with several themes that need different blocks information such as region and weight.


Site administrators

Go to Administer -> Site building -> Blocks

Check the box "Reset blocks" informations then click "Save blocks" to reset the blocks information of the selected theme (default is current theme).

Themes & modules developers

To allow a given theme to override blocks information, create a function called YOUR_THEME_blocks_info() in the template.php file of your theme. Create this file if it does not exist.

The YOUR_THEME_blocks_info() function must return an array that contains blocks information to override. The format is the same as expected in hook_block() for 'list' operation.
More information about hook_block() is available in the Drupal API pages :

The blocks_per_theme_reset_blocks($theme_key) function allows to programmatically reset blocks information for a given theme.
It can be useful to refresh the blocks information after adding a new theme, for example.

The blocks_per_theme_reset_blocks_all() function allows to reset blocks information for all enabled themes.

Example :

E.g. with a theme called "mytheme" :

function mytheme_blocks_info() {
  return array (
    'user' => array ( 'weight' => '1', 'region' => 'right', ),
    'myblock1' => array ( 'weight' => '2', 'region' => 'right', ),
    'myblock2' => array ( 'weight' => '1', 'region' => 'footer', ),
    'block_to_hide' => array ( 'status' => '0', ),

Todo / Future

  • documentation into hook_help() may be helpful
  • allow to configure blocks information through admin/build/block/default form and allow to configure if THEME_blocks_info() override default information or not.


This project has been sponsored by Ambika, a french Drupal-driven services company.

Project Information