verbb / icon-picker

A Craft CMS field to select SVG or font icons from a folder for use in your content.
Other
17 stars 8 forks source link

Icon picker where "All" is selected doesn't return any icons #74

Closed Antimated closed 1 year ago

Antimated commented 1 year ago

Describe the bug

Hello 👋

I just installed the Icon Picker plugin and followed the docs to display some .svg icons. I have no icon sets except the default "All" option.

I can't for the life of me display any svg icons inside an icon picker field without explicitly creating an icon sets which points to the root directory.

Steps to reproduce

  1. Install plugin and setup an icon-picker.php config (I used this one)

    <?php
    
    return [
        'dev' => [
            'enableCache' => false
        ],
        '*' => [
            'iconSetsPath' => '@webroot/assets/icon-picker/',
            'iconSetsUrl' => '@web/assets/icon-picker/',
        ]
    ];
  2. Create an icon picker field whilst only selecting the "All" option.
  3. Add the field to an entry type and check the value of the icon picker.

A temporary solution is creating an icon set of type "SVG Folder" with folder "/" and connecting that icon set to the "Available Icon Sets" of your icon picker field.

Craft CMS version

4.3.6.1

Plugin version

2.0.12

Multi-site?

No

Additional context

No response

engram-design commented 1 year ago

Looks like the default icon set isn't being created when you install the plugin. In order to show any icons, there must be at least one icon set. This is different behaviour to Icon Picker 1. So you're doing the correct thing by creating an icon set for "SVG Folder" with folder "/".

Should be fixed for the next release. To get this early, change your verbb/icon-picker requirement in composer.json to:

"require": {
  "verbb/icon-picker": "dev-craft-4 as 2.0.12",
  "...": "..."
}

Then run composer update.

engram-design commented 1 year ago

Fixed in 2.0.13