Presenting boolean values in the table/list.
Created 7 years ago by william

Lets say i have a field in my module which is an boolean. I want to show the value in the table/list. Then it only shows 1 or nothing. Is there any possibility to manipulate the output? What i really am looking to do is a nice presenter, maybe a red NO button if 0, otherwise a nice green button YES. But its fine if i can at least have it say YES or NO.

ryanthompson  —  7 years ago Best Answer

Check out the presenter and in particular the label method: http://pyrocms.com/documentation/boolean-field-type/v2.1#usage/presenter-output/booleanfieldtypepresenter-label

You can get this in your tables like entry.field_slug.label. Which is just shorthand for entry.field_slug.label().

The toggle method is a nifty one too.

william  —  7 years ago

Yes, toggle is really nice. But since you can toggle in the list, without it being saved/updated ( i assume? ) its not really a good use case.

Label it is😄

william  —  7 years ago