I have a block that I need to embed in a node's Body field. I've tried module_invoke() + PHP Filter, and I've also tried the Insert Block module. In both cases, whenever I embed a Views block, it makes the entire Body field disappear from the rendered page.

Embedding a Block-module block does not make it disappear; the block renders normally. I should also note that when using module_invoke(), that function call itself is sufficient to break the page; even if I delete the print render() line, it's still broken.

More info as I find it:

  • When the page is broken, dpm() calls in node.tpl.php do not output anything.

  • Oh, and I forgot to mention that no PHP errors are being generated. Which I can barely believe too.

  • When the my embed attempts are active, the system_main block array is entirely missing from $page['content'] in page.tpl.php. The #sorted flag is missing from there as well.

  • Shabir's method below yields the same behavior as the other two methods I've tried.

  • dpm()ing the block array (or Shabir's function's return value) shows the block contents as expected. However, the act of rendering the block makes none of the page content get printed.

Anyone have any ideas as to what's happening?

Now I'm having the problem when I call module_invoke() inside the views-view-unformatted--%.tpl.php file. All the view templates will send dpm() calls where they should go, but the content just disappears.

Furthermore, when I dpm($page) in page.tpl.php, $page['content']['system_main']['main']['#markup'] shows a bunch of content for the site's front page! It still doesn't show up, though.

  • As it is a views block try with views_embed_view – J. Reynolds Oct 29 '14 at 6:17
  • It might be helpful if you share the code from your views template file. – othermachines May 1 '15 at 17:12

Include the following snippet in your template.php

function YOURTHEMENAME_render_block($module, $delta, array $options = array()){
  $default_options = array(
    'title' => '<none>',
    'region' => -1,

  $options = array_merge($default_options, $options);

  $block = db_query('SELECT * FROM {block} WHERE module = :module AND delta = :delta', array(':module' => $module, ':delta' => $delta))->fetchObject();
  if($block) {
    $block = block_load($module, $delta);
    $block->title = $options['title'];
    $block->region = $options['region'];
    $blocks = array($block);
    $rblocks = _block_render_blocks($blocks);
    $render_array = _block_get_renderable_array($rblocks);
    return drupal_render($render_array);
  return "";

This will ensure the block exist in next step call this function in your body

print YOURTHEMENAME_render_block('views', 'block-id',array('title'=>'your title of the block if any'));

I hope it will work fine in any case!

  • No good; doing this yields the exact same behavior as the other two methods I've tried. – 75th Trombone Oct 28 '14 at 16:31
  • Is there anything showing up in dpm() – Shabir A. Oct 28 '14 at 16:34
  • I forgot to add this before: With any method, I can dpm() the array block. I can also dpm() your function's results and see the entire block's markup perfectly constructed. But the entire page contents are still empty. – 75th Trombone Oct 28 '14 at 16:49
  • Hmm, Can I have a screenshot how you are rendering the body field? – Shabir A. Oct 28 '14 at 17:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.