Problem/Motivation
We want to hide the additional settings details element for our editors, since all we need is for them to select an icon. Our theming handles the rest. But if the field is hidden (by setting #access to FALSE) any new field data will not have an icon style set, causing those icons not to render at all.
Steps to reproduce
Hide the additional settings field on the field widget by altering it's form and setting the #access key to FALSE. Attempt to set an icon on a field that does not yet have one set. The icon will not render.
Proposed resolution
Attached is a patch that modified the form widget so that it uses the first available style value as the default style. The filtering of the style list is moved so that it can be used to select a default from.
Comments
Comment #2
dennis_meuwissen CreditAttribution: dennis_meuwissen commentedComment #3
manuel.adanI extended the patch to fully achieve the intended behaviour. A new user permission has been introduced to manage access to the additional settings area. The new permission is granted by default to authenticated users, both after updating or installing the module, and should be adjusted according to the site preferences.
Comment #4
manuel.adanComment #5
Daniel.Moberly CreditAttribution: Daniel.Moberly commentedCan you re-roll this patch against the latest dev? It doesn't apply.
Comment #6
chrisck CreditAttribution: chrisck commented@Daniel.Moberly I was able to apply the patch today to the latest dev-2.x f4a4ba8. I'm not able to much of a code review, however I can confirm the new permission is available as "Access fontawesome additional settings" and it does indeed work as intended. Thank you dennis_meuwissen and manuel.adan.
Comment #7
Daniel.Moberly CreditAttribution: Daniel.Moberly commentedAh yes, my mistake - I was applying against the dev build for Font Awesome 6.
I would like to push the Font Awesome 6 changes and then re-roll this patch against the new version as there is some collision here.
Comment #8
Daniel.Moberly CreditAttribution: Daniel.Moberly commentedVersion 6 is out. Can you re-roll this against the new release?
Comment #9
chrisck CreditAttribution: chrisck commented@Daniel.Moberly Here is the patch re-rolled against the new release. I've tested the new permissions setting and it is working.
Comment #10
Daniel.Moberly CreditAttribution: Daniel.Moberly commentedThis looks good - thanks to all for their hard work!
Comment #12
Daniel.Moberly CreditAttribution: Daniel.Moberly commentedComment #13
Daniel.Moberly CreditAttribution: Daniel.Moberly commentedAdded a little info to the readme file
Comment #16
juanpablomitriatti CreditAttribution: juanpablomitriatti commentedHi
This patch solved the issue for fontawesome8.x-2.22 version. Given that, the last fontawesome version works only for Drupal 9.4 or higher, then I created a patch for 8.x-2.22 version that hides the additional icon settings form and is not necessary to have that Drupal version.
URL :https://www.drupal.org/files/issues/2022-11-20/hidding_font_awesome_addi...
Comment #17
JuanMitriatti CreditAttribution: JuanMitriatti commentedHi,
I made a correction to the comment patch #16
Comment #18
JuanMitriatti CreditAttribution: JuanMitriatti commentedHi,
In my previous comment, I left a patch that only works for the FontAwesome version 8.x-2.22 #17
At this comment, I leave attached a new patch that works for the latest FontAwesome version (8.x-2.24).