2007-07-19 12:40:28 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2009-03-10 16:03:34 +01:00
|
|
|
* Read-only field to display a non-editable value with a label.
|
|
|
|
* Consider using an {@link LabelField} if you just need a label-less
|
|
|
|
* value display.
|
|
|
|
*
|
2008-01-09 05:18:36 +01:00
|
|
|
* @package forms
|
|
|
|
* @subpackage fields-basic
|
2007-07-19 12:40:28 +02:00
|
|
|
*/
|
|
|
|
class ReadonlyField extends FormField {
|
|
|
|
|
2008-08-12 04:58:48 +02:00
|
|
|
protected $readonly = true;
|
|
|
|
|
2007-07-19 12:40:28 +02:00
|
|
|
function performReadonlyTransformation() {
|
2008-12-04 23:38:32 +01:00
|
|
|
return clone $this;
|
2007-07-19 12:40:28 +02:00
|
|
|
}
|
2011-12-22 13:10:57 +01:00
|
|
|
|
|
|
|
function Value() {
|
|
|
|
if($this->value) return $this->dontEscape ? $this->value : Convert::raw2xml($this->value);
|
|
|
|
else return '<i>(' . _t('FormField.NONE', 'none') . ')</i>';
|
|
|
|
}
|
|
|
|
|
|
|
|
function getAttributes() {
|
|
|
|
return array_merge(
|
|
|
|
parent::getAttributes(),
|
|
|
|
array(
|
|
|
|
'type' => 'hidden',
|
|
|
|
'value' => null,
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
function Type() {
|
|
|
|
return 'readonly';
|
|
|
|
}
|
2011-03-23 05:12:25 +01:00
|
|
|
}
|