fix root icon urls

This commit is contained in:
Yisroel Baum 2026-06-26 10:58:04 +03:00
parent 47254ea356
commit 0ec8403d4f
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9

View file

@ -339,9 +339,8 @@ class ElementController
'id' => $element->getId(), 'id' => $element->getId(),
'title' => $element->getTitle(), 'title' => $element->getTitle(),
'description' => $element->getDescription(), 'description' => $element->getDescription(),
'iconImageUrl' => $this->storageUrl( 'iconImageUrl' => $this->iconImageUrl(
$element->getIconImageUrl(), $element->getIconImageUrl()
'element-icons/',
), ),
'richText' => $element->getRichText(), 'richText' => $element->getRichText(),
'shortPdfPath' => $this->storageUrl( 'shortPdfPath' => $this->storageUrl(
@ -397,6 +396,22 @@ class ElementController
]; ];
} }
private function iconImageUrl(?string $path): ?string
{
if ($path === null) {
return null;
}
if (
str_starts_with($path, 'element-icons/')
|| str_starts_with($path, 'set-icons/')
) {
return $this->filesystem->url($path);
}
return $path;
}
private function storageUrl(?string $path, string $folderPrefix): ?string private function storageUrl(?string $path, string $folderPrefix): ?string
{ {
if ($path === null) { if ($path === null) {