function InlineBlockUsage::getUnused

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/src/InlineBlockUsage.php \Drupal\layout_builder\InlineBlockUsage::getUnused()
  2. 8.9.x core/modules/layout_builder/src/InlineBlockUsage.php \Drupal\layout_builder\InlineBlockUsage::getUnused()
  3. 11.x 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();
}

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