function BlockContent::invalidateBlockPluginCache

Same name in other branches
  1. 9 core/modules/block_content/src/Entity/BlockContent.php \Drupal\block_content\Entity\BlockContent::invalidateBlockPluginCache()
  2. 10 core/modules/block_content/src/Entity/BlockContent.php \Drupal\block_content\Entity\BlockContent::invalidateBlockPluginCache()
  3. 11.x core/modules/block_content/src/Entity/BlockContent.php \Drupal\block_content\Entity\BlockContent::invalidateBlockPluginCache()

Invalidates the block plugin cache after changes and deletions.

2 calls to BlockContent::invalidateBlockPluginCache()
BlockContent::postDelete in core/modules/block_content/src/Entity/BlockContent.php
Acts on deleted entities before the delete hook is invoked.
BlockContent::postSave in core/modules/block_content/src/Entity/BlockContent.php
Acts on a saved entity before the insert or update hook is invoked.

File

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

Class

BlockContent
Defines the custom block entity class.

Namespace

Drupal\block_content\Entity

Code

protected static function invalidateBlockPluginCache() {
    // Invalidate the block cache to update custom block-based derivatives.
    \Drupal::service('plugin.manager.block')->clearCachedDefinitions();
}

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