Problem/Motivation
If a default layout has a custom block placed and overridden layouts exist, deleting the custom block from the default can trigger Error: Call to a member function getEntityTypeId() on null in Drupal\layout_builder\Plugin\Block\InlineBlock->build() (line 218 of core/modules/layout_builder/src/Plugin/Block/InlineBlock.php).
Steps to reproduce
- Add a custom block to a layout default
- Begin editing a layout override, do not save
- Remove the block from the default
- Attempt to continue editing the layout override
Proposed resolution
One of the following changes to \Drupal\layout_builder\Plugin\Block\InlineBlock::getEntity()
:
- allow for returning NULL (in which case all callers must account for that)
- throw an exception when the block cannot be loaded
- ALWAYS return a block (not sure that it's possible)
Remaining tasks
Write tests
Decide on a resolution
User interface changes
TBD
API changes
TBD
Data model changes
N/A
Release notes snippet
N/A