You are here

public function AvatarManager::refreshAllAvatars in Avatar Kit 8

Downloads all avatar previews for a user.

Parameters

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

Return value

\Drupal\avatars\AvatarPreviewInterface[] An array of refreshed avatar preview entities.

Overrides AvatarManagerInterface::refreshAllAvatars

File

src/AvatarManager.php, line 175

Class

AvatarManager
Provides an avatar manager service.

Namespace

Drupal\avatars

Code

public function refreshAllAvatars(UserInterface $user) {
  $previews = [];
  foreach ($this
    ->getAvatarGeneratorsForUser($user) as $avatar_generator) {
    $avatar_preview = $this
      ->refreshAvatarGenerator($user, $avatar_generator, AvatarPreviewInterface::SCOPE_TEMPORARY);
    if ($avatar_preview) {
      $previews[] = $avatar_preview;
    }
  }
  return $previews;
}