So I know the trick for getting a particular block to show up in a custom template -- $block = module_invoke('module', 'block_view', 'whichblock'); print render($block); -- but that seems to break the Block Administration page's settings for any node using said template.

What I want to do instead is to be able to call all the blocks that should be in that region as assigned on the Block Administration page, rather than hardcoding specific blocks.

Is there a way to do this? Or even just a way to check if the block you're invoking is also legitimately set on the Block Administration page? I'd settle for that, since it would at least allow a set of whitelisted blocks to be turned off or on by someone who doesn't have access to (or knowledge of) the code.

Comments

Jaypan’s picture

Why aren't you just assigning blocks to regions through the admin interface?

uzuri’s picture

Because that doesn't actually work one you have a custom template for a region. The blocks assigned in that manner don't show.

Which makes me think I need to do something in my region template to trigger them showing... which is what the question is asking.

Jaypan’s picture

If they aren't showing, you haven't added the following:

print $content;

That will print your blocks.

uzuri’s picture

Yeah, there's a reason I can't do that; pulling very specific things out of $content and chunking them up differently from what that variable gives you was the whole reason I went for the custom template.

But I think I've found a way that I can abandon the custom template and use views to get me the kind of block flexibility that it was giving me, so I'm going to go that way. Kind of an abuse of Views, but it'll do.

Jaypan’s picture

If you need to separate things in $content, it means that the region template isn't the correct template to be altering. You need to alter the templates (or theme functions) that are used to create the $content variable that ends up in that template.

uzuri’s picture

...