BackgroundImageSettingsTextCacheContext.php in Background Image 2.x
File
src/Cache/Context/BackgroundImageSettingsTextCacheContext.php
View source
<?php
namespace Drupal\background_image\Cache\Context;
class BackgroundImageSettingsTextCacheContext extends BackgroundImageBaseCacheContext {
public static function getLabel() {
return t('Background Image: Text Setting');
}
public function getContext() {
$context = $this->backgroundImage ? $this->backgroundImage
->getSettingsHash('text') : 0;
if ((!isset($name) || $name === 'text' || $name === 'text.value') && $this->backgroundImage
->hasEntityToken() && ($entity = $this->manager
->getEntityFromCurrentRoute())) {
$context .= ":{$entity->getEntityTypeId()}:{$entity->id()}";
}
return $context;
}
}