You are here

private function LingotekSettingsContentSingleForm::invalidateLocalTaskCacheBlocks in Lingotek Translation 3.0.x

Same name and namespace in other branches
  1. 8.2 src/Form/LingotekSettingsContentSingleForm.php \Drupal\lingotek\Form\LingotekSettingsContentSingleForm::invalidateLocalTaskCacheBlocks()

Invalidates the local task cache blocks.

1 call to LingotekSettingsContentSingleForm::invalidateLocalTaskCacheBlocks()
LingotekSettingsContentSingleForm::submitForm in src/Form/LingotekSettingsContentSingleForm.php
Form submission handler.

File

src/Form/LingotekSettingsContentSingleForm.php, line 403

Class

LingotekSettingsContentSingleForm
Configure Lingotek

Namespace

Drupal\lingotek\Form

Code

private function invalidateLocalTaskCacheBlocks() {
  if (\Drupal::moduleHandler()
    ->moduleExists('block')) {

    // There is some bug than local tasks block cache is not cleared. Let's do
    // that manually.
    $ids = \Drupal::entityQuery('block')
      ->condition('plugin', 'local_tasks_block')
      ->execute();
    $tags = [];
    foreach ($ids as $id) {
      $block = Block::load($id);
      $tags = array_merge($tags, $block
        ->getCacheTagsToInvalidate());
    }
    Cache::invalidateTags($tags);
  }
}