public function AvatarKitEntityHandler::findFirst in Avatar Kit 8.2
Find the first valid avatar for an entity.
Downloads and caches avatars for a user until first success.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: Get the first avatar for this entity.
Return value
\Drupal\avatars\Entity\AvatarCacheInterface|null An avatar cache entity, or NULL if no avatars could be generated for this entity.
Overrides AvatarKitEntityHandlerInterface::findFirst
File
- src/
AvatarKitEntityHandler.php, line 56
Class
- AvatarKitEntityHandler
- Downloads and caches avatars into entities.
Namespace
Drupal\avatarsCode
public function findFirst(EntityInterface $entity) : ?AvatarCacheInterface {
$all = $this
->findAll($entity);
$current = $all
->current();
return $current;
}