protected function InlineBlock::getEntity in Drupal 10
Same name and namespace in other branches
- 8 core/modules/layout_builder/src/Plugin/Block/InlineBlock.php \Drupal\layout_builder\Plugin\Block\InlineBlock::getEntity()
- 9 core/modules/layout_builder/src/Plugin/Block/InlineBlock.php \Drupal\layout_builder\Plugin\Block\InlineBlock::getEntity()
Loads or creates the block content entity of the block.
Return value
\Drupal\block_content\BlockContentInterface The block content entity.
File
- core/
modules/ layout_builder/ src/ Plugin/ Block/ InlineBlock.php, line 227
Class
- InlineBlock
- Defines an inline block plugin type.
Namespace
Drupal\layout_builder\Plugin\BlockCode
protected function getEntity() {
if (!isset($this->blockContent)) {
if (!empty($this->configuration['block_serialized'])) {
$this->blockContent = unserialize($this->configuration['block_serialized']);
}
elseif (!empty($this->configuration['block_revision_id'])) {
$entity = $this->entityTypeManager
->getStorage('block_content')
->loadRevision($this->configuration['block_revision_id']);
$this->blockContent = $entity;
}
else {
$this->blockContent = $this->entityTypeManager
->getStorage('block_content')
->create([
'type' => $this
->getDerivativeId(),
'reusable' => FALSE,
]);
}
if ($this->blockContent instanceof RefinableDependentAccessInterface && ($dependee = $this
->getAccessDependency())) {
$this->blockContent
->setAccessDependency($dependee);
}
}
return $this->blockContent;
}