You are here

public static function BlockGroupContent::clearBlocksCaches in Block Group 8

Clear caches on delete and create for blocks to show regions and blocks.

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

File

src/Entity/BlockGroupContent.php, line 79

Class

BlockGroupContent
Defines the Block group content entity.

Namespace

Drupal\blockgroup\Entity

Code

public static function clearBlocksCaches() {

  // @todo Rework this once we have plugin deriver cacheability support in
  // https://www.drupal.org/project/drupal/issues/2633878
  // @see \Drupal\system\Entity\Menu::save
  // Invalidate the block cache to update derivatives.
  // @see \Drupal\blockgroup\Plugin\Derivative\BlockGroups::getDerivativeDefinitions
  if (\Drupal::moduleHandler()
    ->moduleExists('block')) {
    \Drupal::service('plugin.manager.block')
      ->clearCachedDefinitions();
  }

  // Refresh theme region list.
  // @see blockgroup_system_info_alter()

  /** @var \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler */
  $theme_handler = \Drupal::service('theme_handler');
  $theme_handler
    ->refreshInfo();

  // Render arrays will be cleared when ConfigEntityBase invalidates the cache
  // tag of this config entity, added in.
  // @see \Drupal\blockgroup\Plugin\Block\BlockGroup::build
}