I’m running a pretty large drupal 7 website.
I’d like to implement esi support on blocks by wrapping each block content with tags.
Now I can do that pretty easilly with theme_preprocess or hook_block_view_alter, but this only works if the block “content” variable passed to the drupal template is a string. If that variable is an array for instance it’s imposible to wrap it in those tags, because this array is parsed in the template.
So the only way I could get it working is after getting the block value returned from the template. But I don’t think the damn drupal even supports that… without hacking the core and outputting the tags before and after template incluision.
But I really don’t want that… so does anybody have an idea how would I be able to achieve this goal ?
Thank you very much!
If the block content is an array you can add a
#prefixand#suffixto it:The
#prefixand#suffixwill be honoured for any Drupal render array when it’s passed throughrender()(ordrupal_render()) so this should solve the problem.