Closed Lefthandmedia closed 5 years ago
ClientConfig is running before your context routing solution (ContextRouter? xrouting? custom plugin?). See #136 #140 #154 #164.
So the context aware settings of Client config are useless when contextrouter is used? Is it possible to add the CC values as normal placeholders with context key as namespace then? something like [[+subsite.MyLabel]] .
Did you read the issues I linked to? You just need to tweak the events used by either ClientConfig or the router.
well yes i read them (not sure i understand it all). Basically the problem won't exist if all values would be saved as actual context settings. Which is probably difficult otherwise someone would have made a PR for it. or the CC plugin needs to run on a later event then Contextrouter. I tried running CC on 'WebPageInit' which comes after 'onHandleRequest' (for Xrouting) and that seems to work. I can't believe the solution can be that simple so its probably not a good idea to do it this way. (Since i can't find an order of events for modx i'm really in the dark here) So the obvious question is then why CC the values doesn't register as actual context settings?
So the obvious question is then why CC the values doesn't register as actual context settings?
Because that's not how I built it, simple as that.
or the CC plugin needs to run on a later event then Contextrouter. I tried running CC on 'WebPageInit' which comes after 'onHandleRequest' (for Xrouting) and that seems to work.
As the 4 other issues mention, you can run CC on OnHandleRequest. You can tweak the priority on the event if the order is still wrong after that. Or you can change your router to run on OnMODXInit, which fires sooner.
I've explained this a dozen times now.
Summary
values for second context doesn't work. keeps getting the value for ';web' context
Step to reproduce
Installed CC with context.aware. I have 2 contexts 'web' and 'subsite', not counting 'Mgr', . create a label(key) 'Mylabel' then create a different value for that key in both context. for web > 'My website' and for subsite > 'My Subsite' on each template i place [[!++MyLabel]]. now on the 'subsite' context all pages say 'My Website'
Trying to trace this back to its origin i think i see that in the plugin
$contextKey = $modx->context instanceof modContext ? $modx->context->get('key') : 'web';
allwas returns either 'web' or 'mgr' when i log it. ($modx->log(modX::LOG_LEVEL_ERROR, 'cc= '.$contextKey);)Environment
ClientConfig version 2.2.0, MODX version 2.7.1,