https://cgit.drupalcode.org/ds/commit/?id=f539fe122059120fbb6e492bdaa0ec...
ds_render_ctools_field uses $block->content['#markup'] to get the rendered content of the block, but that's not always set. _block_render_blocks() sets it if the block function returned a string for the content, but if the block function returns a render array, there's no guarantee that there's a '#markup' key.
The correct way to ensure that the content is a string is drupal_render($block->content);
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | block-content-fix-all-2962309-6.patch | 961 bytes | k_a_l |
Comments
Comment #2
t14 commentedThis was causing issues for me.
The recommended fix suggested by Xen works.
I have attached a patch based on Xen suggested use of drupal_render()
Comment #3
fizzbin commentedAbove fixes our issue as well (blank main-nav populated by block). Recommend t14's patch to be merged ASAP!
Comment #4
k_a_l commentedI'm wondering if we should implement the same for the "Show block content + title" option as well.
Comment #5
xen commentedisset($block->content)isn't quite enough to determine if there's any content. An empty array would be considered content. block.module itself usesisset($block->content) && $block->content.@k_a_l, yes it should.
Comment #6
k_a_l commentedI've added an additional check for an empty block content array.
Comment #7
k_a_l commentedUpdating to "needs review"
Comment #8
shubhraprakash commentedWell you can use
!empty($block->content)to check for both conditions at one go. I have used it in this patch and it works fine.Comment #9
artfulrobot commentedThis caused a major issue for me, but patch in #6 works for me. Thanks.
Comment #10
k_a_l commentedThis seems to be causing a lot of issues for people, including myself, so I'm saying this looks ready to be committed.
Comment #11
dhansen commentedThis breaks all block-base fields with Menus in them. +1 for RTBC.
Comment #12
armrus commented+1 RTBC
Comment #13
jimmynash commentedThis patch fixed my issue with rendering some DS block fields.
Thanks!
Comment #14
rivimey+1 for me.
Any idea when this will get into a stable release?
Comment #15
owenbush commentedThis patch worked for me too.
Comment #16
rivimeyComment #18
aspilicious commentedFixed and tagged a new release.
Sorry for the delay!