craftpulse / craft-colour-swatches

Let clients choose from a predefined set of colours.
MIT License
34 stars 23 forks source link

Error when setting default value to something else than the first. #128

Closed bob-pixeldeluxe closed 2 months ago

bob-pixeldeluxe commented 5 months ago

So im using this field for background colors in a matrix. As soon as i select a default value other than the first i get the following error on the /admin edit page.

Screenshot 2024-04-29 at 15 14 40

plugin version: 4.4.0 craft cms version: 4.8.10

HBunnick commented 5 months ago

Same issue here:

plugin version: 5.0.0 craft cms version: 5.1.1

mediabeastnz commented 4 months ago

Also having this issue on Craft 5

DavidKabelitz commented 4 months ago

Same here

DavidKabelitz commented 4 months ago

No reaction? @bob-pixeldeluxe

bob-pixeldeluxe commented 4 months ago

@DavidKabelitz Nope nothing yet.

michtio commented 3 months ago

Thank you for mentioning everyone, sorry for the radio silence, currently going through some major changes. We will pick this up next week!

DavidKabelitz commented 3 months ago

@michtio Any Update here? Cause it's a major problem

ruudvdboom commented 3 months ago

Changing line 144 of /src/fields/ColourSwatches.php fixes it:

$default = array_values(array_filter($this->options, function($option) {return $option['default'] == 1;}));

Versions: "craftcms/cms": "4.10.4", "craftpulse/craft-colour-swatches": "4.4.0",

phillipsandoveracademy commented 2 months ago

This is happening to us as well.

Versions: "craftcms/cms": "4.10.4", "craftpulse/craft-colour-swatches": "4.4.0"

michtio commented 2 months ago

@ruudvdboom @phillipsandoveracademy @bob-pixeldeluxe @DavidKabelitz @HBunnick

please update Colour Swatches to the latest version. This issue has already been fixed in Version 4.5.2 released the beginning of April..

@mediabeastnz this issue has been Fixed as well at the beginning of April in Version 5.0.2

Please make sure the composer dependencies are up to date.

Closing this issue.

DavidKabelitz commented 2 months ago

@michtio sorry it was and still is not fixed for Craft 4. It just works for Craft 5. That what the people are complaining here about. We removed it nevertheless cause customers are not very happy with a broken CMS for month, we were running on the latest version of it. Thx

michtio commented 2 months ago

@michtio sorry it was and still is not fixed for Craft 4. It just works for Craft 5. That what the people are complaining here about. We removed it nevertheless cause customers are not very happy with a broken CMS for month, we were running on the latest version of it. Thx

It is fixed for Craft 4, in version 4.5.2 - I see here everyone mentions 4.4.0.

I got to the depths of it, apparently the sync (when we release a package) towards the Craft Composer repo was broken, so everyone kept getting 4.4.0 as latest version. This is now resolved (or should be) as well.

As advice I can only give you, don't use the craft update command, but use composer directly as per https://nystudio107.com/blog/updating-craft-cms-without-headaches