Difference between #1 and #3 of
How to extend CFormatter, add i18n support to booleanFormat and use it in CDetailView

Changes

Title unchanged

How to extend CFormatter, add i18n support to booleanFormat and use it in CDetailView

Category unchanged

How-tos

Yii version unchanged

Tags unchanged

CDetailView, CFormatter, translation, i18n, boolean, view

Content changed

[...]
'ID',
'Logged:boolean',
),
));
```
In this case, the formatBoolean() method of the class CFormatter will be applied to th
ae attribute value (see the [class reference](http://www.yiiframework.com/doc/api/1.1/CFormatter#formatBoolean-detail "") for details). This essentially replaces 0 with a 'No', and 1 with a 'Yes', which looks much nicer.

To be exact: the class CFormatter has a public property named `booleanFormat` which defaults to `array('No', 'Yes')`. The `formatBoolean()` method replaces a 0 with its first element, and a 1 with its second element.
[...]
<br>

It is that easy to add new and more complicated formatters and simplify your CDetailView calls.
 Same goes for CGridView.
9 0
9 followers
Viewed: 19 577 times
Version: 1.1
Category: How-tos
Written by: c@cba
Last updated by: c@cba
Created on: Feb 20, 2012
Last updated: 12 years ago
Update Article

Revisions

View all history