Skip to content

Commit 9a9a1bd

Browse files
authored
[FEATURE] Avator Provider (#320)
See https://review.typo3.org/c/Packages/TYPO3.CMS/+/91294 Releases: main
1 parent 7406ff0 commit 9a9a1bd

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the TYPO3 CMS project.
5+
*
6+
* It is free software; you can redistribute it and/or modify it under
7+
* the terms of the GNU General Public License, either version 2
8+
* of the License, or any later version.
9+
*
10+
* For the full copyright and license information, please read the
11+
* LICENSE.txt file that was distributed with this source code.
12+
*
13+
* The TYPO3 project - inspiring people to share!
14+
*/
15+
16+
namespace T3docs\Examples\Backend\Avatar;
17+
18+
use TYPO3\CMS\Backend\Attribute\AsAvatarProvider;
19+
use TYPO3\CMS\Backend\Backend\Avatar\AvatarProviderInterface;
20+
use TYPO3\CMS\Backend\Backend\Avatar\Image;
21+
use TYPO3\CMS\Core\Utility\GeneralUtility;
22+
23+
#[AsAvatarProvider('exampleAvatarProvider')]
24+
class ExampleAvatarProvider implements AvatarProviderInterface
25+
{
26+
/**
27+
* Returns an Image object, prepared for output, based on a given be_users record
28+
*
29+
* @param array<string, scalar> $backendUser be_users record
30+
* @param int $size
31+
*/
32+
public function getImage(array $backendUser, $size): ?Image
33+
{
34+
return GeneralUtility::makeInstance(
35+
Image::class,
36+
'/typo3conf/ext/examples/Resources/Public/Icons/Extension.png',
37+
20,
38+
20,
39+
);
40+
}
41+
}

0 commit comments

Comments
 (0)