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. 10 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
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

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;
}

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