You are here

public function BackgroundImage::getCacheTags in Background Image 2.x

Same name and namespace in other branches
  1. 8 src/Entity/BackgroundImage.php \Drupal\background_image\Entity\BackgroundImage::getCacheTags()
  2. 2.0.x src/Entity/BackgroundImage.php \Drupal\background_image\Entity\BackgroundImage::getCacheTags()

The cache tags associated with this object.

When this object is modified, these cache tags will be invalidated.

Return value

string[] A set of cache tags.

Overrides EntityBase::getCacheTags

File

src/Entity/BackgroundImage.php, line 275

Class

BackgroundImage
Defines the Background Image entity.

Namespace

Drupal\background_image\Entity

Code

public function getCacheTags() {
  $tags = parent::getCacheTags();

  // Make sure to get
  if ($this
    ->hasEntityToken() && ($entity = $this
    ->getBackgroundImageManager()
    ->getEntityFromCurrentRoute())) {
    $tags[] = "{$entity->getEntityTypeId()}:{$entity->id()}";
  }
  return $tags;
}