You are here

public function InlineBlockUsage::getUsage in Drupal 8

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

Gets usage record for inline block by ID.

Parameters

int $block_content_id: The block content entity ID.

Return value

object The usage record with properties layout_entity_id and layout_entity_type.

Overrides InlineBlockUsageInterface::getUsage

File

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

Class

InlineBlockUsage
Service class to track inline block usage.

Namespace

Drupal\layout_builder

Code

public function getUsage($block_content_id) {
  $query = $this->database
    ->select('inline_block_usage');
  $query
    ->condition('block_content_id', $block_content_id);
  $query
    ->fields('inline_block_usage', [
    'layout_entity_id',
    'layout_entity_type',
  ]);
  $query
    ->range(0, 1);
  return $query
    ->execute()
    ->fetchObject();
}