Hi you all.

On "Blocks: theme('blocks', 'REGIONNAME') fails when called in template_preprocess_node" (http://drupal.org/node/759554) is discussed that the usual "theme('blocks', 'REGIONNAME')" fails when using Context.

I've based all the blocks assignment on a site on Context. I've placed on some "content_bottom" region, blocks made with views for calling related content using the URL's NID as argument. Everything works wonderfully, except that I use the print module to create a "friendly print version" and there's no way to call "theme('blocks', 'REGIONNAME')" inside the print.tpl.php template.

My knowledge of PHP doesn't allow me to find inside the Context 3 code what I should call in order to be able to print my $content_bottom region :-(
On some point (context.core.inc, line 103) it clearly states:

// Reroute theme_blocks() through context_blocks to determine block
// visibility by context. Only override theme_blocks() if a theme
// has not overridden it. It is the responsibility of any themes
// implementing theme_blocks() to take advantage of context block
// visibility on their own.

OK, I understand that "theme('blocks', 'REGIONNAME')" is not the way to go using preprocessing functions, but, which is the way to do it?

Anyone knows? Thanks! :-)

Comments

jorditr’s picture

I've tried to figure out if I should substitute
print theme('blocks', 'REGIONNAME');
with
print context_blocks($content_bottom);
with no luck. Any idea?

jorditr’s picture

Please, any help from Context developers? :-)

stewest’s picture

Priority: Critical » Normal

Subscribing. I need this too for context - block in nodes.

In the interim, I'm using the standard blocks admin page (not context UI) and I've used this in my theme template (blueprint):

function mythemename_preprocess_node(&$vars, $hook) {
$vars['my_node_block'] = theme('blocks', 'my_node_block');
}

jorditr’s picture

Yes, I already did the same on one site, but to me is a bad practice, since all the site is commanded with Context.

stewest’s picture

Issue summary: View changes
Status: Active » Closed (outdated)