‪TYPO3CMS  ‪main
TYPO3\CMS\Backend\Backend\Avatar\Avatar Class Reference

Public Member Functions

 __construct (protected readonly FrontendInterface $cache, protected readonly DependencyOrderingService $dependencyOrderingService, protected readonly IconFactory $iconFactory)
 render (array $backendUser=null, int $size=32, bool $showIcon=false)

Protected Member Functions

 getImgTag (array $backendUser, int $size=32)
 getImage (array $backendUser, int $size)
 validateSortAndInitiateAvatarProviders ()
 getBackendUser ()

Protected Attributes

array $avatarProviders = []

Detailed Description

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

Definition at line 34 of file Avatar.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Backend\Backend\Avatar\Avatar::__construct ( protected readonly FrontendInterface  $cache,
protected readonly DependencyOrderingService  $dependencyOrderingService,
protected readonly IconFactory  $iconFactory 

Member Function Documentation

◆ getBackendUser()

TYPO3\CMS\Backend\Backend\Avatar\Avatar::getBackendUser ( )

Definition at line 145 of file Avatar.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Backend\Backend\Avatar\Avatar\render().

◆ getImage()

TYPO3\CMS\Backend\Backend\Avatar\Avatar::getImage ( array  $backendUser,
int  $size 

Get Image from first provider that returns one.

Definition at line 92 of file Avatar.php.

References TYPO3\CMS\Core\Utility\PathUtility\getPublicResourceWebPath().

Referenced by TYPO3\CMS\Backend\Backend\Avatar\Avatar\getImgTag().

◆ getImgTag()

TYPO3\CMS\Backend\Backend\Avatar\Avatar::getImgTag ( array  $backendUser,
int  $size = 32 

Returns an HTML tag of given backend users avatar.

Definition at line 79 of file Avatar.php.

References TYPO3\CMS\Backend\Backend\Avatar\Avatar\getImage().

Referenced by TYPO3\CMS\Backend\Backend\Avatar\Avatar\render().

◆ render()

TYPO3\CMS\Backend\Backend\Avatar\Avatar::render ( array  $backendUser = null,
int  $size = 32,
bool  $showIcon = false 

Renders an avatar based on a Fluid template which contains some base wrapper css classes. 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.

Definition at line 56 of file Avatar.php.

References TYPO3\CMS\Backend\Backend\Avatar\Avatar\getBackendUser(), and TYPO3\CMS\Backend\Backend\Avatar\Avatar\getImgTag().

◆ validateSortAndInitiateAvatarProviders()

TYPO3\CMS\Backend\Backend\Avatar\Avatar::validateSortAndInitiateAvatarProviders ( )

Validates the registered avatar providers


Definition at line 113 of file Avatar.php.

References $GLOBALS, and TYPO3\CMS\Webhooks\Message\$identifier.

Referenced by TYPO3\CMS\Backend\Backend\Avatar\Avatar\__construct().

Member Data Documentation

◆ $avatarProviders

array TYPO3\CMS\Backend\Backend\Avatar\Avatar::$avatarProviders = []

Definition at line 41 of file Avatar.php.