Problem/Motivation
Repeatable: Always
Steps to repeat:
1. Enable Book and Layout Builder modules
2. Enable Layout Builder for Book content type
3. Manage Layout for Book and add Book navigation block to any available section
4. Check 'Display title', select 'Show block only on book pages', add block and save layout
5. Add new content Book page without adding any book (Book outline -> Book should be -None-) and save
6. View a new created page
patch in #8 works for me.
Thank you !
Expected:
Book navigation block should not be on the page.
Actual:
Book navigation block is on the page.
Proposed resolution
Handle empty block plugins the same way BlockViewBuilder does
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#16 | 3007439-emptybuild-16.patch | 8.28 KB | Wim Leers |
#16 | interdiff.txt | 1.88 KB | Wim Leers |
#14 | 3007439-emptybuild-14.patch | 8.2 KB | tim.plunkett |
#10 | 3007439-emptybuild-10.patch | 8.26 KB | Wim Leers |
#10 | interdiff.txt | 974 bytes | Wim Leers |
Comments
Comment #2
tim.plunkettThanks for the bug report!
Somehow we missed the simplest case when working on BlockComponentRenderArrayTest:
What if the ::build() method returns an empty array?
Comment #4
tim.plunkettIt tested against 8.6 by mistake
Comment #5
tim.plunkettComment #8
tim.plunkettComment #9
xopoc CreditAttribution: xopoc at Princeton University commentedpatch in #8 works for me.
Thank you !
Comment #10
Wim LeersTIL
\Drupal\Core\Render\PlaceholderInterface
is a thing! :OIntroduced in #2992410: Provide placeholders for empty blocks (for example, an empty Views listing) apparently.
This "placeholder" concept does not match the one in
\Drupal\Core\Render\Placeholder\PlaceholderStrategyInterface
… that's … very confusing :( I'm very sorry to raise this only now, but I hadn't seen that issue yet, and there was no CR for it. I'll leave a comment there.Indentation nit. Fixed.
Comment #12
Wim LeersRetesting…
Comment #14
tim.plunkettReroll after #3013187: Rename PlaceholderInterface to PreviewFallbackInterface
(that was almost a month ago, how often does RTBC retesting happen these days?!)
Comment #16
Wim LeersIt was late in Tim's timezone. 🤗
Comment #17
alexpottCommitted and pushed 8bf6ee3870 to 8.7.x and 79b59157c5 to 8.6.x. Thanks!
Comment #20
alexpottI ran all the changed tests on 8.6.x before backporting. Looks good.
Comment #22
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedI think this may have introduced a bug: #3088198: Layout builder discards cacheability metadata from blocks when they are rendered without content. If any of the followers here can confirm it, that would be great.