protectedfunctiongetInlineBlockDependency(BlockContentInterface $block_content){ $layout_entity_info = $this->usage->getUsage($block_content->id()); if(empty($layout_entity_info)){ // If the block does not have usage information then we cannot set a
// dependency. It may be used by another module besides layout builder.
return NULL; } $layout_entity_storage = $this->entityTypeManager->getStorage($layout_entity_info->layout_entity_type); $layout_entity = $layout_entity_storage->load($layout_entity_info->layout_entity_id); if($this->isLayoutCompatibleEntity($layout_entity)){ if($this->isBlockRevisionUsedInEntity($layout_entity, $block_content)){ return$layout_entity; }
$this->assertNotEmpty($this->blockStorage->load($default_block_id)); $this->assertNotEmpty($usage->getUsage($default_block_id)); // Remove block from default.
$this->removeInlineBlockFromLayout(); $this->assertSaveLayout(); // Ensure the block in the default was deleted.
$this->blockStorage->resetCache([$default_block_id]); $this->assertEmpty($this->blockStorage->load($default_block_id)); // Ensure other blocks still exist.
$this->assertCount(2, $this->blockStorage->loadMultiple()); $this->assertEmpty($usage->getUsage($default_block_id));