You are here

public function FixedBlockContent::getBlockContent in Fixed Block Content 8

Returns the block content entity linked to this fixed block.

Parameters

bool $create: (optional) Creates a new block content and links it to this fixed block if there is no block content currently linked. Defaults to TRUE.

Return value

null|\Drupal\block_content\BlockContentInterface The custom block linked to this fixed block content, NULL if not found and the create argument is FALSE.

Overrides FixedBlockContentInterface::getBlockContent

1 call to FixedBlockContent::getBlockContent()
FixedBlockContent::calculateDependencies in src/Entity/FixedBlockContent.php
Calculates dependencies and stores them in the dependency property.

File

src/Entity/FixedBlockContent.php, line 112

Class

FixedBlockContent
Configuration entity for the fixed block content.

Namespace

Drupal\fixed_block_content\Entity

Code

public function getBlockContent($create = TRUE) {
  $block_content = $this
    ->getMappingHandler()
    ->getBlockContent($this
    ->id());
  if (!$block_content && $create) {
    $this
      ->exportDefaultContent();
    $block_content = $this
      ->getMappingHandler()
      ->getBlockContent($this
      ->id());
  }
  return $this->blockContent = $block_content;
}