houke / acf-icon-picker

Creates an icon picker ACF field
100 stars 47 forks source link

Icon picker fields break on ACF 6+ with the latest acf-icon-picker installed (1.9.1) #39

Open Dennisscholten opened 6 months ago

Dennisscholten commented 6 months ago

I updated to ACF 6.0.1 and noticed some fatal JS errors in the editor when trying to remove flexible fields that have your icon picker fields in it. I updated your plugin to the latest version, but the issue persists. On the ACF admin screen, the old icon picker fields are now named as unknown, while the new ACF native icon picker field is a new option. It looks like a clash between classnames.

Scherm­afbeelding 2024-05-31 om 10 42 39
blakerr commented 6 months ago

Same here, now Im in dilema to stick with the new solution and rewrite my code or to downgrade ACF :(

Levdbas commented 6 months ago

See https://github.com/houke/acf-icon-picker/pull/38

I fixed the compat with ACF 6.3. I hope @houke can take a look at this soon!

Marty861 commented 6 months ago

See #38

I fixed the compat with ACF 6.3. I hope @houke can take a look at this soon!

Hello guys, does it mean that we can expect new plugin release soon? This plugin is actually much better than official solution released from ACF now and it will be great if both continue to coexist...

Dennisscholten commented 6 months ago

See #38

I fixed the compat with ACF 6.3. I hope @houke can take a look at this soon!

Hey, thanks for diving into it! I imported your commits, but for some reason it doesn't seem to work on ACF 6.3 but it does for sites with 6.2. Any idea what I missed?

Dennisscholten commented 6 months ago

When I remove '!' from this line the custom field shows up like expected:

if (!class_exists('acf_field_icon_picker')) :

But: when I try to remove a layout from a flexible field that has the custom icon picker in it, I get a JS error:

TypeError: Cannot read properties of undefined (reading 'apply') at n.<anonymous> (acf.min.js?ver=6.3.0:1:4734) at HTMLDivElement.i (jquery.min.js?ver=3.7.1:2:86755) at HTMLDivElement.dispatch (jquery.min.js?ver=3.7.1:2:40035) at v.handle (jquery.min.js?ver=3.7.1:2:38006) at Object.trigger (jquery.min.js?ver=3.7.1:2:70124) at ce.fn.init.triggerHandler (jquery.min.js?ver=3.7.1:2:70811) at n.trigger (acf.min.js?ver=6.3.0:1:5269) at n.trigger (acf-input.min.js?ver=6.3.0:1:75045) at acf-input.min.js?ver=6.3.0:1:77153 at o (acf.min.js?ver=6.3.0:1:1406)

Levdbas commented 6 months ago

@Dennisscholten , there is quite a lot of interference from the newly introduced icon picker field by ACF. The reason why editing

if (!class_exists('acf_field_icon_picker')) : works is because you overwrite the existing class by ACF, My PR changes that but we haven't heard from @houke yet. Meanwhile @mike-sheppard made a fork were all fixes are merged: https://github.com/smithfield-studio/acf-svg-icon-picker

Depending on whether @houke is going to respond, it could be an idea to move to that fork instead. Be aware, in the current version of that fork the field name has changed, so you will have to change that as well in your field config. I already made a ticket about that at https://github.com/smithfield-studio/acf-svg-icon-picker/issues/1 which I am going to make a PR for as well.

Levdbas commented 6 months ago

There is now a fork available that fixes this issue and more: https://github.com/smithfield-studio/acf-svg-icon-picker

We plan on actively developing this in the future.

EarthmanWeb commented 5 months ago

Thanks for the efforts all, and the fork @Levdbas - that is great news. Will try that out and report back!!!