public function User::getFile in Avatar Kit 8
Gets File object for an avatar.
Parameters
\Drupal\Core\Session\AccountInterface $account: A user account.
Return value
\Drupal\file\FileInterface A file object.
Overrides AvatarGeneratorBase::getFile
File
- src/
Plugin/ AvatarGenerator/ User.php, line 25
Class
- User
- User plugin.
Namespace
Drupal\avatars\Plugin\AvatarGeneratorCode
public function getFile(AccountInterface $account) {
if (!$account
->isAnonymous() && ($user = CoreUser::load($account
->id()))) {
$entities = $user->{AK_FIELD_PICTURE_USER}
->referencedEntities();
return reset($entities);
}
return NULL;
}