Avatar
Main class to render an avatar image of a certain Backend user, resolving any avatar provider that takes care of fetching the image.
See render() and getImgTag() as main entry points
Table of Contents
Properties
- $avatarProviders : array<string|int, AvatarProviderInterface>
- Sorted and initialized avatar providers
- $cache : FrontendInterface
- $dependencyOrderingService : DependencyOrderingService
- $iconFactory : IconFactory
Methods
- __construct() : mixed
- render() : string
- Renders an avatar based on a Fluid template which contains some base wrapper css classes.
- getBackendUser() : BackendUserAuthentication
- getImage() : Image
- Get Image from first provider that returns one.
- getImgTag() : string
- Returns an HTML <img> tag of given backend users avatar.
- validateSortAndInitiateAvatarProviders() : void
- Validates the registered avatar providers
Properties
$avatarProviders
Sorted and initialized avatar providers
protected
array<string|int, AvatarProviderInterface>
$avatarProviders
= []
$cache read-only
protected
FrontendInterface
$cache
$dependencyOrderingService read-only
protected
DependencyOrderingService
$dependencyOrderingService
$iconFactory read-only
protected
IconFactory
$iconFactory
Methods
__construct()
public
__construct(FrontendInterface $cache, DependencyOrderingService $dependencyOrderingService, IconFactory $iconFactory) : mixed
Parameters
- $cache : FrontendInterface
- $dependencyOrderingService : DependencyOrderingService
- $iconFactory : IconFactory
render()
Renders an avatar based on a Fluid template which contains some base wrapper css classes.
public
render([array<string|int, mixed>|null $backendUser = null ][, int $size = 32 ][, bool $showIcon = false ]) : string
Has a simple caching functionality. Used in Avatar ViewHelper for instance. Renders avatar of a given backend user record, or of current logged-in backend user.
Parameters
- $backendUser : array<string|int, mixed>|null = null
- $size : int = 32
- $showIcon : bool = false
Return values
stringgetBackendUser()
protected
getBackendUser() : BackendUserAuthentication
Return values
BackendUserAuthenticationgetImage()
Get Image from first provider that returns one.
protected
getImage(array<string|int, mixed> $backendUser, int $size) : Image
Parameters
- $backendUser : array<string|int, mixed>
- $size : int
Return values
ImagegetImgTag()
Returns an HTML <img> tag of given backend users avatar.
protected
getImgTag(array<string|int, mixed> $backendUser[, int $size = 32 ]) : string
Parameters
- $backendUser : array<string|int, mixed>
- $size : int = 32
Return values
stringvalidateSortAndInitiateAvatarProviders()
Validates the registered avatar providers
protected
validateSortAndInitiateAvatarProviders() : void