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(),
|
'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) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue