themeum / kirki

Extending the customizer
https://kirki.org
MIT License
1.26k stars 328 forks source link

Multicolor not working with Preset #2489

Open idlevibes95 opened 2 years ago

idlevibes95 commented 2 years ago

Issue description:

I've tried every way I can think of, but Preset just doesn't work with Multicolor (works fine with the Color control). There's no example in the Kirki docs either. Is it possible at all for Multicolor to work with Preset?

Version used:

4.0.21

Using theme_mods or options?

theme_mods

PHP error messages that might be related

JS error messages that might be related

Code to reproduce the issue (config + field(s))

codejp3 commented 2 years ago

I'm fairly new to Kirki and figuring things out myself, but from looking at the JS file that applies presets, I'm going to say NO, it's not an option as-is right now.

/kirki/packages/kirki-framework/module-preset/src/script.js

Presets are applied to a specific controlValue, controlID combo.

Multicolors have multiple choices within a single controlValue, controlID combo, and you want the presets to apply to those multiple choices, not the controlValue, controlID combo.

I think a few JS code edits to that specific file could accomplish what you want, or you could accomplish it by following the example exactly as it is in the docs by setting up individual color fields (instead of a multicolor field) and applying the presets to those individual color fields: https://kirki.org/docs/arguments/preset/