ClientConfig: How to retrieve value inside a processor


I am asking me why I don’t get value from ClientConfig 2.3.2-pl in MODX3 inside GetListProcessor.
I try it with:


But no value.
Where is my mistake?

Thank you in advance.


I can’t reproduce the problem. This should work.


When I try it inside a blank snippet:


it runs perfect.

But inside a processor nothing…
I dont know why…


If your settings are context aware, then make sure you set the context to “Global”.

Are you using context-specific values or just global mode? If context-specific, you may be getting back the global values unless you change the way you initialise MODX to use the different context.

ClientConfig initialises on two events: OnMODXInit and OnHandleRequest. Normally at least OnMODXInit is also fired when initialising MODX in a connector before it gets to a processor, but worth checking how you’re instantiating MODX.

Can’t rule out MODX3 may be a factor, though I haven’t heard any other reports of this sort of issue yet.

I use ClientConfig in global mode.

clientconfig.context_aware = false

but I have indeed more contexts.


no idea?


Like I said, I can’t reproduce the issue.
Using MODX 3.0.1-pl, ClientConfig 2.3.2-pl and the default connector MODx.config.connector_url, I get the correct value with $this->modx->getOption('...');

Maybe try debugging the problem yourself, or if nothing else works, you can always query the value from the database (table modx_clientconfig_setting, class cgSetting).

Don’t found the problem.

How to get value of clientconfig for context specific key?

How do you want to get the value? From your processor? With xPDO?

The context-specific values are in the database table modx_clientconfig_context_value.

SELECT cv.value
FROM `modx_clientconfig_context_value` cv
INNER JOIN `modx_clientconfig_setting` s ON cv.setting = 
WHERE s.key = 'my_setting' AND cv.context = 'my_context_key' 

yes with xPDO.

but cant fetch results inside processor…

$path = $this->modx->getOption('clientconfig.core_path', null, $this->modx->getOption('core_path') . 'components/clientconfig/');
$path .= 'model/clientconfig/';
$clientConfig = $this->modx->getService('clientconfig','ClientConfig', $path);
if ($clientConfig instanceof \ClientConfig) {
	$c = $this->modx->newQuery('cgSetting', ['key' => 'my_setting']);
	$c->innerJoin('cgContextValue', 'ContextValues');
	$c->select($this->modx->getSelectColumns('cgContextValue', 'ContextValues', '', array('value')));
	$c->where(['ContextValues.context' => 'my_context_key']);

	$context_setting = $this->modx->getObject('cgSetting', $c);
	if ($context_setting) {
		$value = $context_setting->get('value');

thank you so much :pray:

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.