You are here

public function EntitySubqueue::getCacheTagsToInvalidate in Entityqueue 8

Returns the cache tags that should be used to invalidate caches.

This will not return additional cache tags added through addCacheTags().

Return value

string[] Set of cache tags.

Overrides EntityBase::getCacheTagsToInvalidate

See also

\Drupal\Core\Cache\RefinableCacheableDependencyInterface::addCacheTags()

\Drupal\Core\Cache\CacheableDependencyInterface::getCacheTags()

File

src/Entity/EntitySubqueue.php, line 357

Class

EntitySubqueue
Defines the EntitySubqueue entity class.

Namespace

Drupal\entityqueue\Entity

Code

public function getCacheTagsToInvalidate() {
  $tags = [];

  // Use the cache tags of the entity queue.
  // @todo Allow queue handlers to control this?
  if ($queue = $this
    ->getQueue()) {
    $tags = Cache::mergeTags(parent::getCacheTagsToInvalidate(), $queue
      ->getCacheTags());

    // Sadly, Views handlers have no way of influencing the cache tags of the
    // views result cache plugins, so we have to invalidate the target entity
    // type list tag.
    // @todo Reconsider this when https://www.drupal.org/node/2710679 is fixed.
    $target_entity_type = $this
      ->entityTypeManager()
      ->getDefinition($this
      ->getQueue()
      ->getTargetEntityTypeId());
    $tags = Cache::mergeTags($tags, $target_entity_type
      ->getListCacheTags());
  }
  return $tags;
}