Notes

  • This module should not be run on a production environment.
  • Backup the database of any system you are going to run this on before running it.
  • The module deletes content created in Layout Builder it considers orphaned. There is no rollback.
  • The module uses the inline block usage service (getUsage) to determine if a block is orphaned or not. As documentation on this service is limited you should confirm it is doing what you expect before using it.

Description

When a page is built using layout builder and a custom block is added, "Create Custom Block", a block of type 'non reusable' or 'inline' is created.

These blocks 'belong' only to the Layout they are added to and can't be used anywhere else unlike normal blocks.

At some points in the past development of Layout Builder and possibly still now while developing it was/is possible for these blocks to be orphaned. The original page/layout can have been deleted/removed but the non reusable custom blocks still exist in the system.

The primary issue with orphaned blocks is that if you have modules supplying those custom blocks and you try to remove/reinstall them you will get errors from the system telling you that you still have content and your module can't be removed.

There is no way in the Drupal system to see these blocks or remove them so you are stuck.

This is what this module helps with. It searches the system for non reusable blocks and checks to see if they are still in use.

If a non reusable block is found to be orphaned and no longer referenced by anything then it is deleted.

Usage

  • Install the module as any other D8+ module using composer.
  • Enable the module and clear cache and then navigate to Admin->Content authoring->Delete Orphaned Block Content.
  • The module will search for orphaned blocks and if any found ask if you want to delete them (all or nothing at the moment).
  • If you wish to continue and delete the orphaned blocks click 'Delete orphans'
  • You will be asked to confirm and if you do the orphaned blocks will be deleted.
Supporting organizations: 
Cyber-Duck funded development of this module.

Project information

Releases