2 declare(strict_types = 1);
18 use Psr\Http\Message\ResponseInterface;
19 use Psr\Http\Message\ServerRequestInterface;
48 $this->iconRegistry = GeneralUtility::makeInstance(IconRegistry::class);
49 $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
58 return new HtmlResponse($this->iconRegistry->getCacheIdentifier());
66 public function getIcon(ServerRequestInterface $request): ResponseInterface
68 $parsedBody = $request->getParsedBody();
69 $queryParams = $request->getQueryParams();
70 $requestedIcon = json_decode($parsedBody[
'icon'] ?? $queryParams[
'icon'],
true);
72 list($identifier, $size, $overlayIdentifier, $iconState, $alternativeMarkupIdentifier) = $requestedIcon;
74 if (empty($overlayIdentifier)) {
75 $overlayIdentifier =
null;
79 $icon = $this->iconFactory->getIcon($identifier, $size, $overlayIdentifier, $iconState);
81 return new HtmlResponse($icon->render($alternativeMarkupIdentifier));