How to insert a block into a node or template in Drupal 7?
Asked 07 September, 2021
Viewed 1.4K times
  • 63
Votes

In Drupal 6, it was easy to insert a block into a template with the following code:

$block = module_invoke('views', 'block', 'view', 'block_name');
print $block['content'];

However, using the same instructions in Drupal 7 does not seem to work. I have looked around and cannot find the new method.

Does Drupal 7 have a routine that can allow for programmatically inserting a block into a template or node?

15 Answer