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>
- Array of sorted and initialized avatar providers
Methods
- getImage() : Image|null
- Get Image from first provider that returns one
- getImgTag() : string
- Returns an HTML <img> tag for the avatar
- render() : string
- Renders an avatar based on a Fluid template which contains some base wrapper classes and does a simple caching functionality, used in Avatar ViewHelper for instance
- getBackendUser() : BackendUserAuthentication
- Returns the current BE user.
- getCache() : FrontendInterface
- getFluidTemplateObject() : StandaloneView
- Returns a new standalone view, shorthand function
- validateSortAndInitiateAvatarProviders() : mixed
- Validates the registered avatar providers
Properties
$avatarProviders
Array of sorted and initialized avatar providers
protected
array<string|int, AvatarProviderInterface>
$avatarProviders
= []
Methods
getImage()
Get Image from first provider that returns one
public
getImage(array<string|int, mixed> $backendUser, int $size) : Image|null
Parameters
- $backendUser : array<string|int, mixed>
-
be_users record
- $size : int
Return values
Image|nullgetImgTag()
Returns an HTML <img> tag for the avatar
public
getImgTag([array<string|int, mixed>|null $backendUser = null ][, int $size = 32 ]) : string
Parameters
- $backendUser : array<string|int, mixed>|null = null
-
be_users record
- $size : int = 32
Return values
stringrender()
Renders an avatar based on a Fluid template which contains some base wrapper classes and does a simple caching functionality, used in Avatar ViewHelper for instance
public
render([array<string|int, mixed>|null $backendUser = null ][, int $size = 32 ][, bool $showIcon = false ]) : string
Parameters
- $backendUser : array<string|int, mixed>|null = null
-
be_users record
- $size : int = 32
-
width and height of the image
- $showIcon : bool = false
-
show the record icon
Return values
stringgetBackendUser()
Returns the current BE user.
protected
getBackendUser() : BackendUserAuthentication
Return values
BackendUserAuthenticationgetCache()
protected
getCache() : FrontendInterface
Return values
FrontendInterfacegetFluidTemplateObject()
Returns a new standalone view, shorthand function
protected
getFluidTemplateObject([string|null $filename = null ]) : StandaloneView
Parameters
- $filename : string|null = null
-
Which templateFile should be used.
Return values
StandaloneViewvalidateSortAndInitiateAvatarProviders()
Validates the registered avatar providers
protected
validateSortAndInitiateAvatarProviders() : mixed