Problem/Motivation
When placing blocks there might be problems due to their empty initial block configuration which causes rendering issues. Once a block cannot be rendered inside a slot, the whole SDC is not displayed anymore in Display builder.
Steps to reproduce
I had the following setup:
- Install Flag and Flag Block module
- Create new Flag type
- Try to add Flag block block into a slot
If you want to fix it you would need to adjust FlagBlock.php block plugin class and add the following lines to prevent errors while rendering:
if (empty($config['flag_block_settings'])) {
return NULL;
}
Proposed resolution
We should not try to render a block when inserting it on the Layers island.
Comments
Comment #2
pdureau commentedTo test, you must type
$ composer require drupal/flag_block:2.0.0to avoid installing Flag 5.x which is incompatible with Flag Block.Maybe because of the fatal which is preventing the HTMX fragments to be updated:
The issue is not happening when using UI Patterns without Display Builder, so this looks like the block plugins equivalent of #3549348: Fatal: Default value for props, on load for the SDC plugins.
In UI Patterns 2, we don't care much about required block settings because it was managed by the Form API:
#requiredrender propertyIn Display Builder, we can render component without subimiting BlockForm, so with a missing required value:
Proposal: as we already do with SDC, with set the default values for required settings, so we need to check the config schema of the block. Unfortunately, it will not solved this specific example because there is no config schema in the (minimally maintained) module : https://git.drupalcode.org/project/flag_block
But at least it will prevent this for the other blocks.
Comment #3
yannickooComment #4
yannickooThanks for checking this Pierre! I have created another issue #3571949: Create config schema for block plugin so this can be solved properly. It's good to know that Display Builder and UI Patterns are in the end just relying on properly defined plugins to make them work as expected.
Comment #5
yannickooComment #6
pdureau commentedBeta4 has already been released.