1

I have inherited a site (in Drupal 6) and the original developers are completely out of the picture. I need to add a block but it looks like they've customized things and blocks are being rendered in a way other than assigning them to block regions as per the default.

I get a lot of warnings to the effect of The block X was assigned to the invalid region Y and has been disabled but those blocks still appear on the site. So they must be being brought in another way. I am not too terribly worried about the warnings (so seeing this discussion is not really what I need: https://drupal.org/node/1172560). I am more concerned that it is taking me hours to add a link and image to the homepage.

I see that the previous developers installed the Nodeblock and Nodeblock Auto modules and the nodes that come in have html ids like: block-nodeblockauto-node_<NID> so I imagine this is how they are being brought in.

But I don't see any options in the admin panel for configuring nodes any further than what I am used to from the default. In looking through the template files for the custom theme, I also do not see where these are being brought in.

Note: I am not in a position to migrate to Drupal 7 so I have to keep things in Drupal 6 for now.

3

In D7 I finally got rid of that message by placing an if ($theme == variable_get('theme_default', '0')) around the region assignment. So the block only gets assigned to my (default) frontend theme which actually contains the region the block is assigned to.

function MYMODULE_block_info_alter(&$blocks, $theme, $code_blocks) {
  if ($theme == variable_get('theme_default', '0')) {
        if (isset($blocks['MYMODULE']['MYMODULE_block'])) {
            $blocks['MYMODULE']['MYMODULE_block']['status'] = 1;
            $blocks['MYMODULE']['MYMODULE_block']['region'] = 'header';
            $blocks['MYMODULE']['MYMODULE_block']['weight'] = 2;
            $blocks['MYMODULE']['MYMODULE_block']['visibility'] = BLOCK_VISIBILITY_NOTLISTED;
        }
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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