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.
Problem/Motivation
Layout Builder field blocks show up on Block UI when they shouldn't
This is because Block UI has a fake node(and user?) context.
Proposed resolution
@tim.plunkett suggested that Block UI would filter out Blocks that have require contexts.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#17 | 2968139-fieldblock-17-interdiff.txt | 2.95 KB | tim.plunkett |
#17 | 2968139-fieldblock-17.patch | 6.01 KB | tim.plunkett |
#16 | 2968139-fieldblock-16-interdiff.txt | 570 bytes | tim.plunkett |
#16 | 2968139-fieldblock-16.patch | 5.4 KB | tim.plunkett |
#14 | 2968139-14.patch | 4.85 KB | tedbow |
Comments
Comment #2
tedbowRemoved the FieldBlock module mention from the summary. Tested it and it doesn't work this way.
Comment #3
tedbowPatch from @tim.plunkett's work
Comment #6
tim.plunkettBump
Comment #7
tim.plunkettAdded a test.
FAIL patch is the interdiff.
Comment #10
tim.plunkettAhh, so we have a test that asserts that user fields can be placed in the Block UI when Layout Builder is installed.
This test was written to capture any bugs with the complex AJAX interactions when displaying field formatter settings within the block form.
All of the assertions could instead be done for a Layout Builder architecture instead of Block UI, but it was nice to have a second implementation to test against.
Any advice?
Comment #11
tim.plunkettComment #12
tedbowThis seems to disruptive. Couldn't a contrib module provide to UI for providing contexts if needed or have some other logic for providing contexts to the block UI?
It seems likes we should only be removing layout builder provided blocks here and the Block module should implement this logic if needed.
Comment #13
tedbowRe #10
\Drupal\layout_builder\Plugin\Block\ExtraFieldBlock
with only the annotation id changed. That way they won't be removed and we could test the blocks plugins in the Block UI.Comment #14
tedbowDrupal\layout_builder\Plugin\Block\FieldBlock
not ExtraFieldBlock. That was a mistake. The test fails because of this error..I am not sure why. I don't see layout_builder setting this in the schema so not sure why the test module would be fail and the regular blocks module won't. Probably missing something simple.
Comment #16
tim.plunkettThe schema expects
field_block
, we need it to also count when it isfield_block_test
.Comment #17
tim.plunkettDiscussed with @phenaproxima, and decided the trickiness around the subclass of FieldBlock deserved more explanation.
Comment #18
phenaproximaPerfect. Thanks, @tim.plunkett. I understand the patch now and feel fine RTBCing it.
Comment #19
catchCommitted and pushed 87646bb85a to 8.7.x and bd32e2e374 to 8.6.x. Thanks!
Comment #22
tim.plunkettSee #3016829: Follow-up for intersection of #3014949 and #2968139