function BlockContent::preDelete

Same name and namespace in other branches
  1. 9 core/modules/block_content/src/Entity/BlockContent.php \Drupal\block_content\Entity\BlockContent::preDelete()
  2. 10 core/modules/block_content/src/Entity/BlockContent.php \Drupal\block_content\Entity\BlockContent::preDelete()

Overrides EntityBase::preDelete

File

core/modules/block_content/src/Entity/BlockContent.php, line 141

Class

BlockContent
Defines the content block entity class.

Namespace

Drupal\block_content\Entity

Code

public static function preDelete(EntityStorageInterface $storage, array $entities) {
    parent::preDelete($storage, $entities);
    
    /** @var \Drupal\block_content\BlockContentInterface $block */
    foreach ($entities as $block) {
        foreach ($block->getInstances() as $instance) {
            $instance->delete();
        }
    }
}

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