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

FeedMe and IconPicker || array/object expected but string given #93

Open DynamiteGoesBoom opened 5 days ago

DynamiteGoesBoom commented 5 days ago

Describe the bug

Hey Crawf,

I was hoping to pick your brain on this weird icon picker import issue. I asked Tommy at P&T about it already but he mentioned this may be more up your alley:

FeedMe is whining about the iconSelect not being an array or object, but isn’t the image below showing that?

Screenshot 2024-06-25 at 2 14 30 PM

My mapping looks like:

"iconSelect": {
  "field": "verbb\\iconpicker\\fields\\IconPickerField",
  "node": "contentBlocks\/cta\/iconSelect",
  "default": ""
},

Screenshot 2024-06-25 at 2 15 25 PM

I’m not sure what else it’s looking for, do you have any thoughts?

Thanks again 🎉

Steps to reproduce

  1. setup icon picker field
  2. import it in via another feed like this one

Craft CMS version

5.2.3

Plugin version

3.0

Multi-site?

No

Additional context

FeedMe is at version 6.1.0

engram-design commented 5 days ago

I've just realised that there's no actual documentation for the format required for Feed Me and icons, sorry about that!

Firstly, there's a bug with the integration, which is fixed for the next release. To get this early, run composer require verbb/icon-picker:"dev-craft-5 as 3.0.0".

Secondly, the value that you provide for the field will depend on what sort of icon your icon sets contain:

[
    {
        "entry": "Icon Picker Feed Me",
        "iconPickerFont": "dropbox:61803",
        "iconPickerSprite": "angle-right",
        "iconPickerSvg": "/brands/black-tie.svg",
        "iconPickerFa5Free": "fas fa-ad"
    }
]
DynamiteGoesBoom commented 4 days ago

Nice @engram-design! Thanks for this. I'll let you know if I run into any snags.

DynamiteGoesBoom commented 3 days ago

@engram-design I have this for my fieldMapping data for FeedMe:

"iconSelect": {
            "field": "verbb\\iconpicker\\fields\\IconPickerField",
            "node": "contentBlocks\/cta\/iconSelect\/value",
            "default": ""
          },

If you look at this feed under About > contentBlocks > cta you'll see the iconSelect and value, but when I run the import that icon never gets added.

Screenshot 2024-06-28 at 12 01 37 PM

Am I missing something?

engram-design commented 2 days ago

Note the value has to match exactly.

Font Awesome 5: far fa-thumbs-up link Font Awesome 6: fa-regular fa-thumbs-up link

DynamiteGoesBoom commented 20 hours ago

It's too bad the values changed so much. There's no easy way to migrate that content over now :/

engram-design commented 14 hours ago

You could use of the the Feed Me events to modify the data at each step, if that’s helpful? You could check against fa and switch to far or the corresponding family