Hello
I'm not sure where to report a bug so I'm posting it here in case anyone finds it useful.
It happens when transforming a CheckboxField to readonly.
The performReadonlyTransformation() method in CheckboxField creates a new CheckboxField_Readonly and passes the text value for 'Yes' or 'No' to the constructor:
function performReadonlyTransformation() {
$field = new CheckboxField_Readonly($this->name, $this->title, $this->value ? _t('CheckboxField.YES', 'Yes') : _t('CheckboxField.NO', 'No'));
$field->setForm($this->form);
return $field;
}
The constructor then calls setValue(). However the setValue() method in CheckboxField_Readonly casts the value to an (int) and then tests it to set the value to either Yes or No.
class CheckboxField_Readonly extends ReadonlyField {
//...
function setValue($val) {
$this->value = (int)($val) ? _t('CheckboxField.YES', 'Yes') : _t('CheckboxField.NO', 'No');
}
}
Since the setValue() function is passed a string and casts it to an int, performReadonlyTransformation() always returns a field with the value 'No'.