Closed senpuukyakuu closed 4 years ago
You may have to clear your font caches, if you're just uploading new files into a directory without re-saving the field. Head to Utilities > Icon Picker > "Re-generate all icon set caches"
Thanks, but that's not the thing, all caches cleared and still the same.
What does your field setting look like? Have you tried re-saving the Icon Picker field?
We've tried everything and now it's showing the icon names but not the svg, in any case we will try you source the icons remotely from Ionicons, problem is I'm not sure were to add this:
use verbb\iconpicker\services\IconSources; use verbb\iconpicker\events\RegisterIconSourceEvent; use yii\base\Event;
Event::on(IconSources::class, IconSources::EVENT_REGISTER_ICON_SOURCE, function(RegisterIconSourceEvent $event) { $icons = [ 'add', 'add-circle', 'add-circle-outline', // ... ];
$event->sources['ion-icons'] = [
'label' => Craft::t('icon-picker', 'Ionicons'),
'url' => 'https://unpkg.com/ionicons@4.4.4/dist/css/ionicons.min.css',
'icons' => $icons,
'classes' => 'icon ion-md-',
'fontName' => 'Ionicons',
];
});
Since I don't feel is a good idea to directly edit the IconSources.php to just add an element to the sources array. Any ideas?
So the icons are there, but the URL to the SVG's must be incorrect? Would you be able to inspect the image that isn't showing and share the URL its being generated? Sorry for the hassle, I just can't replicate it on a number of environments.
If you want to register a new remote set, you'll need to put the above code in a new module
Not running windows (or osx) myself, so havent tested this. But can confirm that a colleague on windows had the same problem.
Solved it by adding this to the icon-picker.php config :see_no_evil:
'iconSetsPath' => CRAFT_BASE_PATH . DIRECTORY_SEPARATOR . 'public' .DIRECTORY_SEPARATOR . 'icons' .DIRECTORY_SEPARATOR,
Somewhere in the code missing a normalizePath(), maybe?
It's also possible that this could be an issue with your webserver's configuration. I was having the same problem on Linux (Ubuntu), and my SVG icons were not showing up in the Icon Picker field.
It turns out that Apache takes over your host's /icons
directory: https://electrictoolbox.com/apache-icons-directory/
I solved this issue by changing my icon sets' directory name and updating the 'iconSetsPath'
and 'iconSetsUrl'
settings in the icon-picker.php
config file.
Although, strictly speaking, this isn't a bug in Icon Picker, maybe you could consider using a different default for the icons directory to avoid this conflict?
@nettum We actually do use normalizePath()
as soon as we can - https://github.com/verbb/icon-picker/blob/craft-3/src/models/Settings.php#L27
@mtnorthrop interesting, didn't realise that. I'll add this to the next major release, as this would be a breaking change for anyone relying on this as-is.
Description
The path to where the icons are is set and still nothing shows on the select field.
Tried with this:
<?php
return [ '*' => [ 'iconSetsPath' => CRAFT_BASE_PATH . '/web/icons/', 'iconSetsUrl' => '/icons/', 'maxIconsShown' => 100, 'redactorFieldHandle' => '', ] ]; And nothing, Tried with the CP version(image attached) and nothing.
Nothing appear on the select field to pick the icons.
Steps to reproduce
Additional info