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

Font Awesome 6 style selection for kit #75

Open sanderpotjer opened 1 year ago

sanderpotjer commented 1 year ago

What are you trying to do?

When loading Font Awesome 6 via a kit, all styles are loaded. Unfortunaltey you can't configure this from within a kit in Font Awesome. It would be great if we can select in the Icon Sets settings of Icon Picker which of the kit styles should be used.

Currently all styles are loaded, resulting in many "duplicates" and we're only using one style on the frontend.

Schermafbeelding 2023-02-24 om 16 04 29

What's your proposed solution?

Adding an option to select/set the styles in the Icon Sets settings. Via the fetchIcons the famlilyStyles are loaded, basically you want to be able to select from this options and only load icons of the selected style(s).

Additional context

No response

pascalminator commented 3 months ago

I tought I could bypass this limitation by creating a kit restrained to one specific style only in Font Awesome, but it does not work really well :

Capture d’écran 2024-03-28 120437

It still shows the same icon multi time, but with the same style. There is also some icons that just does not show up at all. This feature request is a must and I don't understand why it's being ignored by the devs.

engram-design commented 3 months ago

While you can restrict the kits in the Font Awesome settings:

image

That's not accessible via the API when fetching the kit, which would what I would expect, and have been waiting on a response from them about this.

Otherwise, we're going to have to add another checkbox in the icon set settings to select your styles. This isn't ideal as it could lead to confusing results (you only enable the "Solid" style in your kit settings, but you try and load "Solid" and "Sharp" in the Icon Picker set settings - you'll only load "Solid" due to the kit restrictions).

Still looking into options.

engram-design commented 2 months ago

Just to provide feedback here, the Font Awesome crew say it's not currently possible to limit API responses for a style, so we would need to manage this on our end. We'll probably have to introduce some checkboxes on which styles to include, despite the API pulling them all in. It would be filtering on our end.

It's a bit of double-handling, but there's no other option at the moment.

pascalminator commented 2 months ago

I am personally totally fine with your proposition to add checkboxes in the settings. It would prevent end users to select incorrect styles and would fix my problems.

engram-design commented 2 months ago

Added for the next release. To get this early, run composer require verbb/icon-picker:"dev-craft-4 as 2.0.17".