diff --git a/Classes/Backend/Avatar/MoveElevatorAvatarProvider.php b/Classes/Backend/Avatar/MoveElevatorAvatarProvider.php new file mode 100644 index 0000000..931e126 --- /dev/null +++ b/Classes/Backend/Avatar/MoveElevatorAvatarProvider.php @@ -0,0 +1,45 @@ + $backendUser + */ + public function getImage(array $backendUser, mixed $size): ?Image + { + if ((int)($backendUser['avatar'] ?? 0) > 0) { + return null; + } + + $email = strtolower((string)($backendUser['email'] ?? '')); + if ($email === '' || !str_ends_with($email, self::EMAIL_DOMAIN)) { + return null; + } + + $resource = $this->systemResourceFactory->createPublicResource(self::LOGO_PATH); + + return new Image( + (string)$this->resourcePublisher->generateUri($resource, null), + $size, + $size, + ); + } +} diff --git a/README.md b/README.md index f72f068..b573439 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ This extension provides several tools for TYPO3 integrators and developers. - Adds a CSS view helper that enables the rendering of a `noscript` variant and allows inline styles to be replaced by a key-value-based `inlineReplacements` option flag - Adds a sentry middleware and frontend module ... - Adds a custom TYPO3 page renderer template which removes some unnecessary spaces and changes the order of inline CSS injection +- Adds a backend avatar provider that assigns the move elevator logo to backend users with an `@move-elevator.de` email address (when no custom avatar is set) ## Version support @@ -96,6 +97,12 @@ The `ContentMinifierEventListener` automatically minifies the HTML output of all | Remove CKEditor data attributes | Strips `data-list-item-id` attributes from `
  • ` elements added by CKEditor 5 ([TYPO3#109002](https://forge.typo3.org/issues/109002), [CKEditor5#19006](https://github.com/ckeditor/ckeditor5/issues/19006)) | | Trim tag content whitespace | Removes leading/trailing whitespace inside `h1`–`h6`, `p`, `li`, `td`, `th`, `dt`, `dd`, `button`, and `label` tags | +### Backend Avatar + +The `MoveElevatorAvatarProvider` automatically assigns the move elevator logo (`Resources/Public/Icons/me.svg`) as the backend avatar for any backend user whose email address ends with `@move-elevator.de`. + +Personal avatars uploaded via the user settings always take precedence — the logo is only used as a fallback when no custom avatar is configured. + ### Middlewares | Middleware | Path/ Parameter | Description | diff --git a/Resources/Public/Icons/me.png b/Resources/Public/Icons/me.png new file mode 100644 index 0000000..568bb64 Binary files /dev/null and b/Resources/Public/Icons/me.png differ diff --git a/Resources/Public/Icons/me.svg b/Resources/Public/Icons/me.svg new file mode 100644 index 0000000..0ac693f --- /dev/null +++ b/Resources/Public/Icons/me.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/ext_localconf.php b/ext_localconf.php index 6bc5d17..cee45da 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -1,5 +1,6 @@ AssetRenderer::class, ]; + $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['getBackendUserAvatar']['moveElevatorAvatar'] = [ + 'provider' => MoveElevatorAvatarProvider::class, + ]; + $extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get(Configuration::EXT_KEY->value); if ((bool)($extConf['sentryBackendEnabled'] ?? false)) { $GLOBALS['TYPO3_CONF_VARS']['SYS']['debugExceptionHandler'] = SentryClient\DebugExceptionHandler::class;