public function AvatarKitLocalCache::cacheEmpty in Avatar Kit 8.2
Creates an empty avatar cache entity.
Used if a valid cache entity could not be created.
Parameters
string $service_id: An avatar service ID.
string|null $uri: The URL of an avatar.
\Drupal\avatars\EntityAvatarIdentifierInterface $identifier: An entity avatar identifier.
Return value
\Drupal\avatars\Entity\AvatarCacheInterface An avatar cache entity.
Overrides AvatarKitLocalCacheInterface::cacheEmpty
File
- src/
AvatarKitLocalCache.php, line 153
Class
- AvatarKitLocalCache
- Cache remote files locally into file entities.
Namespace
Drupal\avatarsCode
public function cacheEmpty(string $service_id, ?string $uri, EntityAvatarIdentifierInterface $identifier) : AvatarCacheInterface {
$identifier_hash = $identifier
->getHashed();
/** @var \Drupal\avatars\Entity\AvatarCacheInterface $avatar_cache */
$avatar_cache = $this->avatarCacheStorage
->create([
'avatar_service' => $service_id,
'identifier' => $identifier_hash,
'avatar' => NULL,
]);
$avatar_cache
->save();
return $avatar_cache;
}