Breaking change introduced in a38b572 ("Update to version 6.4.2")

Created on 29 January 2024, 10 months ago
Updated 5 February 2024, 10 months ago

Problem/Motivation

Commit a38b5725 changes the $iconPrefix values from their short names (i.e. "fab," "fas," etc.) to their full names ("fa-brands," "fa-solid," etc.). However, for those who are already using the module and have data stored in their databases, this causes the icons in the icon picker widget to get blanked out. The values saved in the database before this change are using the short names. Because there isn't currently a provision to parse both versions of the prefix names, the existing values in the database break and make it look like nothing has previously been selected. And, because the old values are not parsed correctly, if I save the form without re-selecting the icons, the values get wiped out and data is lost.

Steps to reproduce

To reproduce this issue:

  1. Spin up a vanilla Drupal 10 site
  2. Install the Fontawesome module at commit (8fe2fcd): composer require 'drupal/fontawesome:2.x-dev#8fe2fcd'
  3. Install the required libraries.
  4. Enable the module and the fontawesome_iconpicker_widget submodule.
  5. Add a field and configure it to use the icon picker widget
  6. Create a piece of content and select an icon, and then save the content item
  7. Update your composer require statement to get the problematic commit (a38b572): composer require 'drupal/fontawesome:2.x-dev#a38b572'
  8. Clear the cache on your site
  9. Visit the "view" version of the content item you created and note that the fontawesome icon is visible
  10. Visit the "edit" page of the content item. You should see that the icon is now missing and displays the default "unselected" icon , even though an icon was previously selected and saved into the database.

Proposed resolution

In the code that parses the $iconPrefix values, check for the full name AND the short name, and convert short names to full names. This will avoid data loss.

Remaining tasks

I will attempt to create a patch and add it here.

πŸ› Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States paramnida

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024