How can I override the column value for a plugin in the Craft CMS control panel?

For example:

  • Append "Hello " in front of a particular column value, or add hyperlink HTML markup to a value, in each row where the value makes a particular condition.

For the life of me, I can't figure out how to hijack column values!

1 Answer 1


Depending on how complex your needs, you might do with the following:

I've used this combo to alter field value display in the control panel.

For example, if a myField can contain a value of '1', then in a Preparse Field I do this:

{% if element.myField == 1%}ONE{% endif %}

And then using Control Panel JS, I can check the value of that field in the CP (in this case, checking for '1'), and then add/remove a CSS class, change the value of the HTML, etc. Part of the reason to use Preparse fields is they allow you to shorten the column header.

It's a little fiddly, but it works well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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