You are here

private function LayoutBuilder::prepareBlockContentIds in Entity Usage 8.2

Prepare block content target entity values to be in the correct format.

Parameters

array $blockContentRevisionIds: An array of block (content) revision IDs.

Return value

array An array of the corresponding block IDs from the revision IDs passed in, each prefixed with the string "block_content|".

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

1 call to LayoutBuilder::prepareBlockContentIds()
LayoutBuilder::getTargetEntities in src/Plugin/EntityUsage/Track/LayoutBuilder.php
Retrieve the target entity(ies) from a field item value.

File

src/Plugin/EntityUsage/Track/LayoutBuilder.php, line 148

Class

LayoutBuilder
Tracks usage of entities related in Layout Builder layouts.

Namespace

Drupal\entity_usage\Plugin\EntityUsage\Track

Code

private function prepareBlockContentIds(array $blockContentRevisionIds) {

  /** @var \Drupal\Core\Entity\ContentEntityStorageInterface $blockContentStorage */
  $blockContentStorage = $this->entityTypeManager
    ->getStorage('block_content');

  /** @var \Drupal\block_content\BlockContentInterface[] $blockContent */
  $ids = $blockContentStorage
    ->getQuery()
    ->condition($blockContentStorage
    ->getEntityType()
    ->getKey('revision'), $blockContentRevisionIds, 'IN')
    ->execute();
  return array_map(function (string $id) : string {
    return 'block_content|' . $id;
  }, $ids);
}