-
-
Notifications
You must be signed in to change notification settings - Fork 232
Add support for icon picker #725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@robertalexa this looks awesome. Do you have any screenshots on how this looks in the current backend theme? As for upgrading Font Awesome, our current fork is using FA 6.1.1 as I made the upgrade in May. There was a manual element to it - I tried to use the LESS edition of the Font Awesome source files, but I believe I had to make substantial edits for us to cover all our legacy bases. If we need to upgrade again, I can have another crack at doing it and either make it more automated or at least document what I did. |
modules/backend/formwidgets/iconpicker/partials/_iconpicker.php
Outdated
Show resolved
Hide resolved
|
@bennothommo The picker looks the same on both default and tailwindui theme. I had an attempt and thought that it would be great to instead use a variable (the branding colours that the user selects) but I have discovered inconsistencies between the use of those brandings between the default and tailwindui theme. So i have left this for now. |
|
@LukeTowers any news on this? |
|
@jaxwilko it needs to be loaded from a YAML file like a nestedform form config instead of a config file. I can do that sometime this week if @robertalexa can't. |
|
@LukeTowers What difference does that make if neither of these options is the real good long term one? The real good one is to actually handle this "library" of icons as part of the update process of fontawesome at But to do it the right way now, it requires font awesome updated, the shims done once, in 1 place, and married with an existing FA, with regular, solid and brands categories in mind, and with the update process defined and documented. |
|
Regardless of the long term improvements to the icon updating process for the Winter core the API for this particular form widget will remain the same: icon:
label: Icon
type: iconpicker
libraries:
fontawesome: ...
materialui: ...
# or
libraries: ~/modules/backend/formwidgets/iconpicker/meta/libraries.yamlIt will not be a config file at any point. Another change that needs to be made is renaming |
form:
fields:
icon:
label: 'Icon'
type: 'iconpicker'
default: 'far icon-angry'
libraries:
-
id: 'far'
title: "Font Awesome Regular"
prefix: "far icon-"
listicon: "far icon-circle"
icons:
- "far icon-address-book"
- "far icon-address-card"
icon2:
label: 'Icon'
type: 'iconpicker'
default: 'far icon-angry'
libraries: ~/modules/backend/formwidgets/iconpicker/meta/libraries.yaml
icon3:
label: 'Icon'
type: 'iconpicker'Use the above to test. These are the current variations supported using the approach suggested by @LukeTowers
The above example shows:
In the grand scheme of things, the libraries.yaml file should be rebuild as part of FA update process. I can't guarantee that the current list contains all the icons available in the current (winter) FA version, but I can guarantee that everything that is included is 100% supported. |
|
Looking amazing so far @robertalexa! Just the few items remaining:
This widget should at its core act like an enhanced text input. If a value is present that is not defined in the configured library then it should still load, display, and persist that value as if it was a regular text box, but it will just not show any icon preview. With that in mind, the behaviour for those two cases should be as follows:
|
|
@LukeTowers I have implemented changes based on your feedback. First icon picker open (no value, set default, unavailable in the library): Second icon picker open (no value, set default, available in the library) Third icon picker open (no value, no set default, first icon in library) |
|
Awesome work @robertalexa, thanks! Could you put together a PR to the docs to document it? |









Add support for an icon picker field. This took inspiration from https://github.com/hasinhayder/vue3-icon-picker but was modified greatly in the end.
Offers support for extending the fonts library dynamically.
A few notes: