I’m setting up a template that takes advantage of ClientConfig and multiple chunks to generate a custom css and UI via CSSsweet. The idea is letting the user choose style things like colors and fonts, and structural things like social icons in top bar/footer or hamburger/normal menu.
It all works quite neatly but i’m having issues regarding ClientConfig.
1. Context-Aware mode is sketchy
Example 1: Image field with the logo that goes in the header is called with [[++header_logo]]. If the context field has a value it works, if it’s just the global value it returns a broken image “/”. That happens also with text fields, like company phone, mail.
Example 2: [[++main_color]], this values is parsed with csssweet but only takes the global one, context specific color is totally ignored, but i might be missing something.
A- Is there a way to force global values? I don’t know, something like [[++config-setting]] -> defaults to global value and [[++config-setting:context]] -> takes the current context value
B- Maybe a way to disable the global thing alltogether and force users to fill every context separately? (Not optimal i know)
C- Maybe if a context specific field is empty have it replaced by the global value on save? (Good for fallbacks etc)
D- Have context specific groups? So i can have the “Theme Options” tab only on global and the “Company details” tab for every context? (FTW).
A and D would be good additions to ClientConfig imho
For now to avoid issues i have disabled the context-aware function and everything is working as intended, but it would be helpful to have more flexibility for multisites/multilanguage projects.
2. I have CSSSweet set to update on “ClientConfig_ConfigChange” but it only trigger if i save the configuration twice.
It also works correctly if i manually empty modx cache or save the base chunk for csssweet. But we usually hide all chunks and system elements to the end user so it would be optimal if the config event actually refreshed csssweet as well on the first save.