You are here

public function AvatarManager::invalidateUserAvatar in Avatar Kit 8

Invalidate any cache where the user avatar is displayed.

Call if the avatar has changed, or is expected to change.

Parameters

\Drupal\user\UserInterface $user: A user entity.

Overrides AvatarManagerInterface::invalidateUserAvatar

File

src/AvatarManager.php, line 257

Class

AvatarManager
Provides an avatar manager service.

Namespace

Drupal\avatars

Code

public function invalidateUserAvatar(UserInterface $user) {
  if (isset($user->{AK_FIELD_PICTURE_ACTIVE}->entity)) {
    $this->cacheTagInvalidator
      ->invalidateTags($user->{AK_FIELD_PICTURE_ACTIVE}->entity
      ->getCacheTags());
  }
}