colorit icon indicating copy to clipboard operation
colorit copied to clipboard

Multi-Site Support

Open moacode opened this issue 6 years ago • 2 comments

Use Case

I wanted to be able to set field specific settings per site. I.e., it'd be great to create a bunch of presets (e.g. themes for each site), and toggle that preset on the same field.

What I did

Craft doesn't support multi-site field settings out of the box. The simplest approach I could think of was to simply store the site specific settings in an array key called "siteSettings", and direct Craft to load those ones when required, otherwise falling back to the default settings.

I added a toggle so users can choose whether their color settings will be propagated across all sites, or specific to each site.

I also removed the translation field, as I don't think it's relevant for this field type? (Correct me if I'm wrong!).

How to test

  1. Install plugin
  2. Create some presets
  3. Create multiple sites
  4. Create a colorit field and assign to a section
  5. Test setting a preset on the field, and ensure it's the same between each site.
  6. Now toggle the "Multi-Site" light switch, and ensure you can set individual presets for each site.
  7. Do the same with color palettes.
  8. Ensure the correct colors display on you entries.

(Note: I tested mine inside a matrix).

moacode avatar Jun 19 '19 05:06 moacode

Is this going to be reviewed and implemented @samhibberd ?? This is a must have feature.

michtio avatar Apr 23 '20 15:04 michtio

Yes absolutely @michtio, field presets / settings might be getting a little restructure which needs to be considered carefully to ensure backwards compatibility, we will implement either way.

Thanks for the pr @thejoshsmith.

samhibberd avatar Apr 23 '20 15:04 samhibberd