function SetInlineBlockDependency::isBlockRevisionUsedInEntity

Same name in other branches
  1. 9 core/modules/layout_builder/src/EventSubscriber/SetInlineBlockDependency.php \Drupal\layout_builder\EventSubscriber\SetInlineBlockDependency::isBlockRevisionUsedInEntity()
  2. 8.9.x core/modules/layout_builder/src/EventSubscriber/SetInlineBlockDependency.php \Drupal\layout_builder\EventSubscriber\SetInlineBlockDependency::isBlockRevisionUsedInEntity()
  3. 10 core/modules/layout_builder/src/EventSubscriber/SetInlineBlockDependency.php \Drupal\layout_builder\EventSubscriber\SetInlineBlockDependency::isBlockRevisionUsedInEntity()

Determines if a block content revision is used in an entity.

Parameters

\Drupal\Core\Entity\EntityInterface $layout_entity: The layout entity.

\Drupal\block_content\BlockContentInterface $block_content: The block content revision.

Return value

bool TRUE if the block content revision is used as an inline block in the layout entity.

1 call to SetInlineBlockDependency::isBlockRevisionUsedInEntity()
SetInlineBlockDependency::getInlineBlockDependency in core/modules/layout_builder/src/EventSubscriber/SetInlineBlockDependency.php
Get the access dependency of an inline block.

File

core/modules/layout_builder/src/EventSubscriber/SetInlineBlockDependency.php, line 155

Class

SetInlineBlockDependency
An event subscriber that returns an access dependency for inline blocks.

Namespace

Drupal\layout_builder\EventSubscriber

Code

protected function isBlockRevisionUsedInEntity(EntityInterface $layout_entity, BlockContentInterface $block_content) {
    $sections_blocks_revision_ids = $this->getInlineBlockRevisionIdsInSections($this->getEntitySections($layout_entity));
    return in_array($block_content->getRevisionId(), $sections_blocks_revision_ids);
}

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