Comments (3)
I was attempting to do something like this by doing the following in the config file. It works and shows the correct palettes but it seems to have trouble saving or something:
$sitePalettes = [
'siteOneHandle' => [ ... siteOnePaletteData ... ],
'siteTwoHandle' => [ ... siteTwoPaletteData ... ]
]
return [
'palettes' => [
'Colours' => $sitePalettes[Craft::$app->request->getQueryParam('site')],
],
];
from craft-colour-swatches.
Actually I just figured it out I think.
You need to make a generic palette with ALL the options, then per site.
$useSite = Craft::$app->request->getQueryParam('site') ?? 'allSites';
$sitePalettes = [
'allSites' => [ ... siteOnePaletteData & siteTwoPaletteData ... ]
'siteOneHandle' => [ ... siteOnePaletteData ... ],
'siteTwoHandle' => [ ... siteTwoPaletteData ... ]
]
return [
'palettes' => [
'Colours' => $sitePalettes[$useSite],
],
];
from craft-colour-swatches.
hello @pixelmachine,
Apologies for taking so long to reply. The way around would be settings a global field. Select the pallet you want for that site.
from craft-colour-swatches.
Related Issues (20)
- Custom attributes can only be set as a child of color property? HOT 5
- Can't seem to limit to just the first color option in template HOT 3
- Colors not saving when in Matrix inside of Super Table HOT 1
- Element list in control panel - color preview is not displaying corretly if selected option has more than one color HOT 6
- Element list in control panel - color preview is not displaying corretly if selected option has more than one color
- Array to String conversion error HOT 4
- Set configuration via Control Panel HOT 2
- Default swatch value returns as null HOT 6
- Syntax error when switching from Dropdown field type HOT 1
- Class Not found exception: percipioglobal\colourswatches\fields\ColourSwatches while creating new field. HOT 3
- Search by color swatches field HOT 2
- Add the option to show color labels next to option, without the need to hover HOT 2
- [Docs] Incorrect plugin name used in installation step HOT 1
- Craft 5 Support HOT 5
- Colour Swatches fields unavailable for use in field visibility conditions (Craft 4+)
- New errors logging after upgrading to 4.4.0 HOT 9
- Error occurs when entering colors directly in the CMS field
- Error when setting default value to something else than the first. HOT 12
- Undefined Array Key 0 Error in Craft 5.36 Colour Swatches 5.0.2 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from craft-colour-swatches.