You are here

public function SetFixedBlockDependency::onGetDependency in Fixed Block Content 8

Handles the BlockContentEvents::INLINE_BLOCK_GET_DEPENDENCY event.

Parameters

\Drupal\block_content\Event\BlockContentGetDependencyEvent $event: The event.

File

src/EventSubscriber/SetFixedBlockDependency.php, line 62

Class

SetFixedBlockDependency
An event subscriber that sets the access dependency for fixed blocks.

Namespace

Drupal\fixed_block_content\EventSubscriber

Code

public function onGetDependency(BlockContentGetDependencyEvent $event) {
  if ($dependency = $this
    ->getFixedBlockDependency($event
    ->getBlockContentEntity())) {
    $event
      ->setAccessDependency($dependency);
  }
}