// If the entity is new or '$entity->original' is not set then there will
// not be any unused inline blocks to remove.
// If this is a revisionable entity then do not remove inline blocks. They
// could be referenced in previous revisions even if this is not a new
// revision.
if ($entity->
isNew() || !
isset($entity->original
) ||
$entity instanceof RevisionableInterface
) { return;
} // If the original entity used the default storage then we cannot remove
// unused inline blocks because they will still be referenced in the
// defaults.
if ($this->
originalEntityUsesDefaultStorage($entity)) { return;
} // Delete and remove the usage for inline blocks that were removed.
if ($removed_block_ids =
$this->
getRemovedBlockIds($entity)) { $this->
deleteBlocksAndUsage($removed_block_ids);
} } /**
* Gets the IDs of the inline blocks that were removed.
*
* @param \Drupal\Core\Entity\EntityInterface $entity
* The layout entity.
*
* @return int[]
* The block content IDs that were removed.
*/