1

I've come across an issue where I've got a celltype which contains array data stored as a JSON string.

When I json_encode the array and return it on save_cell(), display_cell() then returns the JSON quote wrappers as entities?

What I expect:

[{"first_name":"Garret","last_name":"Winder"},{"first_name":"Jeff","last_name":"Claeson"},{"first_name":"Paul","last_name":"Burton"}]

What I get:

[{"first_name":"Garret","last_name":"Winder"},{"first_name":"Jeff","last_name":"Claeson"},{"first_name":"Paul","last_name":"Burton"}]

Is there any way I can disable this in Matrix? Presumably if I set the column formatting to 'none' somehow in the cell settings it'll resolve it - I couldn't see how to do that in the docs?

For now I'm just finding and replacing the " entities before decoding...

Thanks Iain

1

The issue here seems to be that in Matrix 2.3 form_prep is called during the display_cell method:

Cell data is now run through form_prep(), just like normal field data

If you're outputting the input with form_textarea or form_input that also calls form_prep() leading to the double encoding.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.