function InlineBlockUsage::addUsage

Same name in other branches
  1. 9 core/modules/layout_builder/src/InlineBlockUsage.php \Drupal\layout_builder\InlineBlockUsage::addUsage()
  2. 8.9.x core/modules/layout_builder/src/InlineBlockUsage.php \Drupal\layout_builder\InlineBlockUsage::addUsage()
  3. 11.x core/modules/layout_builder/src/InlineBlockUsage.php \Drupal\layout_builder\InlineBlockUsage::addUsage()

File

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

Class

InlineBlockUsage
Service class to track inline block usage.

Namespace

Drupal\layout_builder

Code

public function addUsage($block_content_id, EntityInterface $entity) {
    $this->database
        ->merge('inline_block_usage')
        ->keys([
        'block_content_id' => $block_content_id,
        'layout_entity_id' => $entity->id(),
        'layout_entity_type' => $entity->getEntityTypeId(),
    ])
        ->execute();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.