You are here

private function LayoutBuilder::prepareBlockContentIds in Entity Usage 8.4

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/EntityTrack/Track/LayoutBuilder.php
Retrieve the target entity(ies) from a field item value.

File

src/Plugin/EntityTrack/Track/LayoutBuilder.php, line 136

Class

LayoutBuilder
Tracks usage of entities related in Layout Builder layouts.

Namespace

Drupal\entity_usage\Plugin\EntityTrack\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);
}