You are here

public function InlineBlockUsage::removeByLayoutEntity in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/src/InlineBlockUsage.php \Drupal\layout_builder\InlineBlockUsage::removeByLayoutEntity()

Remove usage record by layout entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The layout entity.

Overrides InlineBlockUsageInterface::removeByLayoutEntity

File

core/modules/layout_builder/src/InlineBlockUsage.php, line 56

Class

InlineBlockUsage
Service class to track inline block usage.

Namespace

Drupal\layout_builder

Code

public function removeByLayoutEntity(EntityInterface $entity) {
  $query = $this->database
    ->update('inline_block_usage')
    ->fields([
    'layout_entity_type' => NULL,
    'layout_entity_id' => NULL,
  ]);
  $query
    ->condition('layout_entity_type', $entity
    ->getEntityTypeId());
  $query
    ->condition('layout_entity_id', $entity
    ->id());
  $query
    ->execute();
}