Hi there,

Just wondering if something has changed recently in the core with relation to _block_render_blocks?

I'm trying to use a module to insert a block into a node, and the replacement patter it uses relies on the function _block_render_blocks. But it returns a balnk array for some reason?

I'm passing in this array;

stdClass Object ( [module] => blocks [delta] => nandos_bites_block-block )

Anyone know what might have changed?

When it's used in the module, it passes in in an array and the output of _block_render_blocks is a blank array...so I'm guessing thatg the array I'm passing in is probably not in the right format?

Thanks,

Mark

PS - If I get this sorted, I will actually put a patch out for the module (providing I can work out how)

Comments

nevets’s picture

Looking at

I'm passing in this array;

stdClass Object ( [module] => blocks [delta] => nandos_bites_block-block )

I only see single object, not an array of blocks (objects). What does your code look like?

markosaurus’s picture

Passing this data in, you're right, it's an object. Any idea if this used to be an array?

$block: stdClass Object
(
[bid] => 113
[module] => views
[delta] => bites_block-block
[theme] => garland
[status] => 1
[weight] => -12
[region] => content
[custom] => 0
[visibility] => 1
[pages] => our-story
[title] => NB BLock
[cache] => -1
)

$block_content = _block_render_blocks(array($block));
$build = '';
$build = _block_get_renderable_array($block_content);
$replacement = drupal_render($build);

It's fine when we hit $block, that returns the data above, but when I do;

_block_render_blocks(array($block));

That fails as it passes an object and not an array. Any idea of a different way to do it? Or should I just cast the object data into an array?

markosaurus’s picture

ThoughtI'd post the answer in case it helps anyone else later...

Nothing has changed in core to cause this...I was outputting the body value rather than the markup in node.tpl.php.