Skip to content

Instantly share code, notes, and snippets.

@chadmandoo
Last active December 19, 2015 05:29
Show Gist options
  • Save chadmandoo/5904584 to your computer and use it in GitHub Desktop.
Save chadmandoo/5904584 to your computer and use it in GitHub Desktop.
Drupal programmatically render a block
<?php
//module_invoke('module_name', 'block_view', 'block_identifier')
//Printing using Drupal block system
$block = module_invoke('block', 'block_view', '1');
print render($block['content']);
//Printing using a contrib module block, this example uses the weather module
$block = module_invoke('weather', 'block_view', 'user');
print render($block['content']);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment