MODX Community

Babel stops working if context keys have dots in them

Hi,

I have one Modx install with 100+ contexts, and the context keys contain dots.
I found out that Babel does not work if just one of the contexts contains a dot in the context key, but as you know, I can’t change the contextkeys.

I posted a topic about this earlier, but in that case I could fix it by duplicating all contexts and not use dots in the context keys anymore.

In this particular case I can’t do this, because there are to many context and settings/modifications linked to the context keys.

The problem seems to be that a Ext.data.Record can’t access a field with .get(field_name) or .data[field_name] when the field_name contains a dot. And here some field names contain the context-key.
Fortunately the record has an inner object called “json” where all the data is accessible. So you could try this:

In the file assets/components/babel/js/mgr/widgets/grid.resourcematrix.js make the following changes.

//Replace this line
if (rec.get(meta.id) === '') {
//with this line
if (rec.json[meta.id] === ''){

//Replace this line
var pagetitle = rec.get('linkedres_pagetitle_' + ctx);
//with this line
var pagetitle = rec.json['linkedres_pagetitle_' + ctx];

//Replace this line
var cellvalue = rec.data[colName];
//with this line
var cellvalue = rec.json[colName];

Each line appears twice in the code!

Then clear the browser cache, reload the Babel CMP and check if it works now.

Thanks Halftrainedharry,

I changed all the lines (twice) and cleared both my browser cache and modx cache (manual with rm -vrf cache/*) and the Babel overview page is still not working. I have some linked resources and on the front-end it all works fine, but on the babel manager page it doesn’t show any linked resouces.

Open the ‘Network’-Tab of the ‘Developer Tools’ in your browser, then choose a context in the dropdown (on the left side of your screenshot) and click the button ‘Filter’.
A new AJAX-call should appear in the list with the action mgr/resource/getMatrixList.
Is there any JSON-data in the response of this call?

Thanks for your reply.
I have 138 contexts, but it is only showing 19 in de “contexts” within the form data.
Could this have to do with this problem?


The modContextGetListProcessor limits the results to 20 rows by default.

You should be able to change this if add this line

$this->setProperty('limit',200);

right after this line in core/components/babel/processors/mgr/context/getlist.class.php