cms icon indicating copy to clipboard operation
cms copied to clipboard

Custom Set Icons not working

Open andjsch opened this issue 5 months ago • 4 comments

Bug description

In my local environment, the icons are showing. On the staging and production server, I do not get them, it falls back to the default icon.

I am using schantldev/statamic-phosphoricons.

This is the svg-icon-component in my local environment:

Image

This in my prod env:

Image

Besides the directory of course being different, I don't see any difference. I also tried to retrieve the icons via Icon::getCustomSvgIcons() which works fine. Getting a fine JSON response. I also see that output within the HTML when I inspect the source before the JS loads. What could I be overseeing?

Image

How to reproduce

Really not sure in this case.

Logs


Environment

Environment
Application Name: "Statamic"
Laravel Version: 12.18.0
PHP Version: 8.4.7
Composer Version: 2.8.8
Environment: local
Debug Mode: ENABLED
URL: reiserei.test
Maintenance Mode: OFF
Timezone: UTC
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: file
Database: sqlite
Logs: stack / single
Mail: smtp
Queue: sync
Session: file

Storage
public/storage: NOT LINKED

Statamic
Addons: 4
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 5.57.0 PRO

Statamic Addons
schantldev/statamic-phosphoricons: 1.0.1
studio1902/statamic-peak-browser-appearance: 3.6.1
studio1902/statamic-peak-seo: 8.23.0
studio1902/statamic-peak-tools: 7.3.1

Installation

Starter Kit using via CLI

Additional details

No response

andjsch avatar Jun 11 '25 11:06 andjsch

I debugged this a bit and it seems to be a problem with the data_get() function used here: https://github.com/statamic/cms/blob/5.x/resources/js/components/SvgIcon.vue#L46

It doesn't like dots within the path. Not sure what the best workaround would be. Maybe this.$config.get('customSvgIcons')[directory][file] would do?

@duncanmcclean I'd provide a PR if you are fine with the above approach instead of using the data_get() function.

andjsch avatar Jun 11 '25 12:06 andjsch

I've also used a repetable blocks to set custom icons to each block, but they are not showing

vitalijalbu avatar Jun 11 '25 12:06 vitalijalbu

I've also used a repetable blocks to set custom icons to each block, but they are not showing

Do you have the Vue Devtools browser extension installed? Can you confirm having a dot somewhere in your directory?

andjsch avatar Jun 11 '25 12:06 andjsch

I'd provide a PR if you are fine with the above approach instead of using the data_get() function.

Sure, feel free to submit a PR.

duncanmcclean avatar Jun 11 '25 12:06 duncanmcclean