I am creating a custom Drupal profile and put down the following code.

function erc_360_min_hook_block_info_alter(&$blocks, $theme, $code_blocks) {
  $theme = 'erc_generic';
  $blocks['user']['login']['status'] = 1;
  $blocks['user']['login']['region'] = 'footer_first';

As far as I can tell, this is correct in terms of what Drupal is asking for, but after the installation, and going to look in my structure->blocks page, it does not update the blocks region at all.

Why isn't it working? The theme is correct.


1 Answer 1


There are two errors in the code you show.

  • If erc_360_min is the machine name of the profile, the correct name of the implementation of that hook is erc_360_min_block_info_alter()

  • Setting $theme in that hook doesn't have any effect outside that function, since the parameter is not an object nor is it passed as reference; you rather use that parameter to check you are altering the blocks shown for a specific theme

See dashboard_block_info_alter() as guide to write your code.

function dashboard_block_info_alter(&$blocks, $theme, $code_blocks) {
  $admin_theme = variable_get('admin_theme');
  if (($admin_theme && $theme == $admin_theme) || (!$admin_theme && $theme == variable_get('theme_default', 'bartik'))) {
    foreach ($blocks as $module => &$module_blocks) {
      foreach ($module_blocks as $delta => &$block) {
        // Make administrative blocks that are not already in use elsewhere
        // available for the dashboard.
        if (empty($block['status']) && (empty($block['region']) || $block['region'] == BLOCK_REGION_NONE) && !empty($code_blocks[$module][$delta]['properties']['administrative'])) {
          $block['status'] = 1;
          $block['region'] = 'dashboard_inactive';

Setting the region for the block is correct, but it's not correct what I previously described.

Your Answer

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

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