craftpulse / craft-colour-swatches

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

Field does not return serialized values via `getSerializedFieldValues()` #137

Open chrismlusk opened 2 months ago

chrismlusk commented 2 months ago

When calling the Element's getSerializedFieldValues() method on an element that has a Colour Swatches field in the field layout, the return is not serialized — it's the model.

In the following example, I have an element with a field handle colorTheme.

When I call:

$element->getSerializedFieldValues();

I get:

[
    // other fields, which are all serialized as expected...
    'colorTheme' => percipiolondon\colourswatches\models\ColourSwatches {...}
]

That method calls each field's serializeValues() method here in Craft source.

I do see in this plugin's source that the Colour Swatches field has its own serializeValues() implementation, so I'm not quite sure what is happening.


Craft v4.11.5 Colour Swatches v4.5.2

linear[bot] commented 2 months ago

DEV-2169 Field does not return serialized values via `getSerializedFieldValues()`

michtio commented 2 months ago

Thank you for the issue, we will look into it!