includeHiddenField = $includeHiddenField; } public function performReadonlyTransformation() { return clone $this; } /** * @param array $properties * @return HTMLText */ public function Field($properties = array()) { // Include a hidden field in the HTML if($this->includeHiddenField && $this->readonly) { $hidden = clone $this; $hidden->setReadonly(false); return parent::Field($properties) . $hidden->Field($properties); } else { return parent::Field($properties); } } /** * If $dontEscape is true the returned value will be plain text * and should be escaped in templates via .XML * * If $dontEscape is false the returned value will be safely encoded, * but should not be escaped by the frontend. * * @return mixed|string */ public function Value() { if($this->value) { if($this->dontEscape) { return $this->value; } else { return Convert::raw2xml($this->value); } } else { $value = '(' . _t('FormField.NONE', 'none') . ')'; if($this->dontEscape) { return $value; } else { return ''.Convert::raw2xml($value).''; } } } public function getAttributes() { return array_merge( parent::getAttributes(), array( 'type' => 'hidden', 'value' => $this->readonly ? null : $this->value, ) ); } public function Type() { return 'readonly'; } }