You are here

public function InlineBlockUsage::getUnused in Drupal 8

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

Gets unused inline block IDs.

Parameters

int $limit: The maximum number of block content entity IDs to return.

Return value

int[] The entity IDs.

Overrides InlineBlockUsageInterface::getUnused

File

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

Class

InlineBlockUsage
Service class to track inline block usage.

Namespace

Drupal\layout_builder

Code

public function getUnused($limit = 100) {
  $query = $this->database
    ->select('inline_block_usage', 't');
  $query
    ->fields('t', [
    'block_content_id',
  ]);
  $query
    ->isNull('layout_entity_id');
  $query
    ->isNull('layout_entity_type');
  return $query
    ->range(0, $limit)
    ->execute()
    ->fetchCol();
}