public function testReadonlyField() { $sourceArray = array(0 => 'No', 1 => 'Yes'); $field = new OptionsetField('FeelingOk', 'are you feeling ok?', $sourceArray, 1); $field->setEmptyString('(Select one)'); $field->setValue(1); $readonlyField = $field->performReadonlyTransformation(); preg_match('/Yes/', $field->Field(), $matches); $this->assertEquals($matches[0], 'Yes'); }
public function setValue($value) { // Extract custom option from postback if (is_array($value)) { if (empty($value['Options'])) { $value = ''; } elseif ($value['Options'] === self::CUSTOM_OPTION) { $value = $value['Custom']; } else { $value = $value['Options']; } } return parent::setValue($value); }