You are here

protected function InlineBlockEntityOperations::deleteBlocksAndUsage in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/src/InlineBlockEntityOperations.php \Drupal\layout_builder\InlineBlockEntityOperations::deleteBlocksAndUsage()
  2. 9 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.

File

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

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);
}