#2756331: Custom blocks cannot be properly exported and imported is pretty nasty in therm of UX but apparently hard to fix.
Basically, if you export a custom block configuration and import this configuration in a new website you will have a "This block is broken or missing" error has the content is effectively missing.
But we perhaps give the user a chance to save is website by replacing:
"This block is broken or missing. You may be missing content or you might need to enable the original module."
by
"'The content of the block (%bundle %uuid) is missing. Add missing content.'.
Proposed resolution
- Listen to missing content event in block content module.
- Take note of missing block content UUIDs
- Store them in state.
- In the derivative discovery, make definitions available for those UUIDs
- In the build method for these, output a link with a prebuilt uuid and type (taken from the missing content event stuff that is saved in state)
- This link will create a stub entity of that type and with that uuid and then present the edit form
- User submits, hey presto its fixed
- State entry is cleaned up when block is saved
- Tests cover that scenario
Remaining tasks
Approach as per comment 37