function BlockContentBlock::getEntity

Same name in other branches
  1. 9 core/modules/block_content/src/Plugin/Block/BlockContentBlock.php \Drupal\block_content\Plugin\Block\BlockContentBlock::getEntity()
  2. 8.9.x core/modules/block_content/src/Plugin/Block/BlockContentBlock.php \Drupal\block_content\Plugin\Block\BlockContentBlock::getEntity()
  3. 11.x 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 208

Class

BlockContentBlock
Defines a generic 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;
}

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