Hi folks,

Love this module! But, having trouble embedding into a node. I set my input type to PHP and embeded this code:

$block = module_invoke('ddblock', 'block', 'view','1');
print $block['content'];

The "1" was the block number I got when hovering over the block link. Any idea what I'm doing wrong?

Here's a link to that test page if you want to see. Many thanks!!

http://www.burnardweb.com/take3/node/9#overlay-context=node/9

Comments

ppblaauw’s picture

Title: Can't seem to embed in a node » How to embed a block in a node?
Status: Active » Postponed (maintainer needs more info)

The block hooks in drupal core have changed. Instead of one hook_block with operants there are now 4 separate block hooks.

To embed a block in drupal 7 use:

<?php
$block = module_invoke('ddblock', 'block_view', '1');
print $block['content'];
?>

Parameters in module invoke
first parameter - module to call: 'ddblock'
second parameter - hook to call: 'block_view'
third parameter - arguments: in this case the delta of the block

Hope this helps you further, please let me know.

jburnard’s picture

That did it! Thanks so much for the quick reply!

ppblaauw’s picture

Title: How to embed a block in a node? » How to embed a block in a node? (fixed)
Status: Postponed (maintainer needs more info) » Fixed

set status to fixed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

halohaloplace’s picture

This works like magic. However, is there a way to embed a block that can be viewed by permission (e.g., by admin only)? I tried to set permission to view this block then followed the code above, but it still show to anonymous viewers. Any answer is greatly appreciated!

vali hutchison’s picture

This didn't work for me until i changed ddblock to block and then worked fine:

<?php
$block = module_invoke('block', 'block_view', '1');
print $block['content'];
?>