Skip to content

Instantly share code, notes, and snippets.

@elliottb
Created June 18, 2013 22:00
Show Gist options
  • Save elliottb/5809846 to your computer and use it in GitHub Desktop.
Save elliottb/5809846 to your computer and use it in GitHub Desktop.
Drupal 6 i18n compatible replacement for module_invoke() that displays a block with block delta (encoded name) and region. Replaces this logic: $block = module_invoke('menu', 'block', 'view', 'menu-responsive-platforms'); print $block['content']; With logic that is language (i18n) friendly. Adapted from here: http://stackoverflow.com/questions/4…
function render_i18n_block($block_name, $region = "hidden") {
if ($list = block_list($region)) {
foreach ($list as $key => $block) {
if ($block_name == $block->delta){
print $block->content;
}
}
}
}
//usage
print render_i18n_block('my-block', 'footer');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment