Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The content of some Drupal 7 blocks are returned as render arrays. Other D7 sites can render those, but D6 sites cannot.
In the D7 version, add another argument to the sharedblocks/%/%
menu callback to specify the format. In sharedblocks_fetch_block()
, tack array
at the end of the URL.
In sharedblocks_publish_block()
, check this new argument. If it's 'array' (as it will be when D7 sites are requesting the block), encode the $block
array as-is; otherwise, assume that the requesting site cannot handle render arrays, and render $block['content']
if it is an array, before encoding it.
Comments
Comment #1
Dave ReidI have a feeling that we probably just need to standardize what gets sent and returned, rather than handle multiple formats. I propose the following, always 'sending' a simple array with 'subject' with the block title on the providing site, and 'content' which is just HTML, and not render array.
Comment #2
Dave ReidFixed with http://drupalcode.org/project/sharedblocks.git/commit/974952d