I am using views and random sort criteria along with block refresh to try and display a random teaser when a user clicks refresh. Everything seems to be working fine up until the moment I click refresh, at which point I am receiving Array instead of the content. I have tried with ajax enabled and disabled on the view itself to no effect. I have also tried without the random sort with the same problem. I have block refresh working fine on non views. What would be the best way to try and debug? I cannot see any error messages.

CommentFileSizeAuthor
#3 return_array-1144106-3.patch560 bytesidflood

Comments

michaellander’s picture

7wonders, let me try and replicate this and get back to you. Do you have this issue with the auto refresh by chance?

7wonders’s picture

I suppose it would have been smart of me to try that before posting :)

But yes, it also gives array on the auto refresh. Let me know what I can do to help debug. Im using latest dev of pretty much everything.

idflood’s picture

StatusFileSize
new560 bytes

I had the same issue with a block from another module. The issue seems to come from the fact that blocks can now return their content as string or renderable array. Here is a little patch that should fix this.

idflood’s picture

Status: Active » Needs review
michaellander’s picture

Status: Needs review » Closed (fixed)

There was a slight typo in the is_array, but i'm rolling it in as we speak. It will be in the next release. Thanks for your help idflood!

idflood’s picture

Status: Closed (fixed) » Active

great : )
But I should have read the source of render() before creating the patch. The is_array check is included in it, so it could have avoided me this typo.

We can then theoretically remove the if/else and just do:
print render($block['content']);

( http://api.drupal.org/api/drupal/includes--common.inc/function/render/7 )

michaellander’s picture

haha dangit, maybe I should have read it as well. I'll roll it into DEV for the next update.

michaellander’s picture

Version: 7.x-1.1 » 7.x-1.2
Status: Active » Closed (fixed)

In dev. Thanks!