Problem/Motivation
When creating a new page, get a JS "Cannot read properties of undefined (reading 'icons')".
This issue happens because fontawesome_iconpicker_widget attaches its JS behavior globally via Drupal.behaviors, but the drupalSettings.fontawesomeIcons data is only attached at the field element level, so when page loads initially, before the paragraph containing the icon picker field is rendered, the behavior fires and drupalSettings.fontawesomeIcons is undefined, causing the crash.
Also notice in modules/fontawesome_iconpicker_widget/js/fontawesome-iconpicker.js might have a misspeling at line 27
searchSourc: $terms,
Steps to reproduce
Add a paragraph text field with this widget in it to any content type, create a new page, open developer console and see JS errors.
Proposed resolution
Fix misspeling(?), check for drupalSettings.fontawesomeIcons
Remaining tasks
Review patch
| Comment | File | Size | Author |
|---|---|---|---|
| fontawesome-iconpicker-guard.patch | 952 bytes | drase15 |
Comments