fix root icon urls
This commit is contained in:
parent
47254ea356
commit
0ec8403d4f
1 changed files with 18 additions and 3 deletions
|
|
@ -339,9 +339,8 @@ class ElementController
|
|||
'id' => $element->getId(),
|
||||
'title' => $element->getTitle(),
|
||||
'description' => $element->getDescription(),
|
||||
'iconImageUrl' => $this->storageUrl(
|
||||
$element->getIconImageUrl(),
|
||||
'element-icons/',
|
||||
'iconImageUrl' => $this->iconImageUrl(
|
||||
$element->getIconImageUrl()
|
||||
),
|
||||
'richText' => $element->getRichText(),
|
||||
'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
|
||||
{
|
||||
if ($path === null) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue