You are here

protected function InlineBlockEntityOperations::deleteBlocksAndUsage in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/src/InlineBlockEntityOperations.php \Drupal\layout_builder\InlineBlockEntityOperations::deleteBlocksAndUsage()

Delete the inline blocks and the usage records.

Parameters

int[] $block_content_ids: The block content entity IDs.

2 calls to InlineBlockEntityOperations::deleteBlocksAndUsage()
InlineBlockEntityOperations::removeUnused in core/modules/layout_builder/src/InlineBlockEntityOperations.php
Removes unused inline blocks.
InlineBlockEntityOperations::removeUnusedForEntityOnSave in core/modules/layout_builder/src/InlineBlockEntityOperations.php
Remove all unused inline blocks on save.

File

core/modules/layout_builder/src/InlineBlockEntityOperations.php, line 201

Class

InlineBlockEntityOperations
Defines a class for reacting to entity events related to Inline Blocks.

Namespace

Drupal\layout_builder

Code

protected function deleteBlocksAndUsage(array $block_content_ids) {
  foreach ($block_content_ids as $block_content_id) {
    if ($block = $this->blockContentStorage
      ->load($block_content_id)) {
      $block
        ->delete();
    }
  }
  $this->usage
    ->deleteUsage($block_content_ids);
}