You are here

protected function BlockContentBlock::getEntity in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/block_content/src/Plugin/Block/BlockContentBlock.php \Drupal\block_content\Plugin\Block\BlockContentBlock::getEntity()

Loads the block content entity of the block.

Return value

\Drupal\block_content\BlockContentInterface|null The block content entity.

3 calls to BlockContentBlock::getEntity()
BlockContentBlock::blockAccess in core/modules/block_content/src/Plugin/Block/BlockContentBlock.php
Indicates whether the block should be shown.
BlockContentBlock::blockForm in core/modules/block_content/src/Plugin/Block/BlockContentBlock.php
Overrides \Drupal\Core\Block\BlockBase::blockForm().
BlockContentBlock::build in core/modules/block_content/src/Plugin/Block/BlockContentBlock.php
Builds and returns the renderable array for this block plugin.

File

core/modules/block_content/src/Plugin/Block/BlockContentBlock.php, line 206

Class

BlockContentBlock
Defines a generic custom block type.

Namespace

Drupal\block_content\Plugin\Block

Code

protected function getEntity() {
  if (!isset($this->blockContent)) {
    $uuid = $this
      ->getDerivativeId();
    if ($id = $this->uuidLookup
      ->get($uuid)) {
      $this->blockContent = $this->entityTypeManager
        ->getStorage('block_content')
        ->load($id);
    }
  }
  return $this->blockContent;
}