public function FixedToContentMappingHandler::releaseBlockContent in Fixed Block Content 8
Breaks the link between a fixed block and a block content.
Parameters
\Drupal\fixed_block_content\FixedBlockContentInterface $fixed_block: The fixed block whose block content to be released.
Overrides FixedToContentMappingHandlerInterface::releaseBlockContent
1 call to FixedToContentMappingHandler::releaseBlockContent()
- FixedToContentMappingHandler::setBlockContent in src/
FixedToContentMappingHandler.php - Links a fixed block to a block content.
File
- src/
FixedToContentMappingHandler.php, line 127
Class
- FixedToContentMappingHandler
- Fixed block to block content mapping entity handler.
Namespace
Drupal\fixed_block_contentCode
public function releaseBlockContent(FixedBlockContentInterface $fixed_block) {
// In the case of protected blocks, the block content must be deleted to
// prevent orphaned block content.
if ($fixed_block
->isProtected() && ($block_content = $fixed_block
->getBlockContent(FALSE))) {
$block_content
->delete();
}
// Delete the fixed block link with the block content.
$this->database
->delete('fixed_block_content')
->condition('fbid', $fixed_block
->id())
->execute();
}