protected function FixedBlockContent::setBlockContent in Fixed Block Content 8
Links a block content with this fixed block.
Any existing block content is not deleted, unless on protected fixed blocks. If the given block is new, it will be saved to reference it.
Parameters
\Drupal\block_content\BlockContentInterface $block_content: (optional) The new block content to link to this fixed block. New empty block is created if none given.
Throws
\InvalidArgumentException When the content type of the given block mismatches the configured type.
1 call to FixedBlockContent::setBlockContent()
- FixedBlockContent::exportDefaultContent in src/
Entity/ FixedBlockContent.php - Export the default content stored in config to the content block.
File
- src/
Entity/ FixedBlockContent.php, line 135
Class
- FixedBlockContent
- Configuration entity for the fixed block content.
Namespace
Drupal\fixed_block_content\EntityCode
protected function setBlockContent(BlockContentInterface $block_content = NULL) {
// Create a new empty block content if no one given.
if (!$block_content) {
$block_content = $this
->newBlockContent();
}
// Link this fixed block with the content block.
$this
->getMappingHandler()
->setBlockContent($this, $block_content);
$this->blockContent = $block_content;
}