2007-07-19 12:40:28 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* This field lets you put an arbitrary piece of HTML into your forms.
|
2008-10-16 15:26:25 +02:00
|
|
|
*
|
2008-01-09 05:18:36 +01:00
|
|
|
* @package forms
|
|
|
|
* @subpackage fields-dataless
|
2007-07-19 12:40:28 +02:00
|
|
|
*/
|
|
|
|
class LiteralField extends DatalessField {
|
2008-10-16 15:26:25 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @var string $content
|
|
|
|
*/
|
2007-07-19 12:40:28 +02:00
|
|
|
protected $content;
|
|
|
|
|
|
|
|
function __construct($name, $content) {
|
|
|
|
$this->content = $content;
|
2008-10-16 15:26:25 +02:00
|
|
|
|
|
|
|
parent::__construct($name);
|
2007-07-19 12:40:28 +02:00
|
|
|
}
|
2008-10-16 15:26:25 +02:00
|
|
|
|
2007-07-19 12:40:28 +02:00
|
|
|
function FieldHolder() {
|
|
|
|
return is_object($this->content) ? $this->content->forTemplate() : $this->content;
|
|
|
|
}
|
2008-10-16 15:26:25 +02:00
|
|
|
|
2007-07-19 12:40:28 +02:00
|
|
|
function Field() {
|
|
|
|
return $this->FieldHolder();
|
|
|
|
}
|
|
|
|
|
2008-10-16 15:26:25 +02:00
|
|
|
/**
|
|
|
|
* Sets the content of this field to a new value
|
|
|
|
* @param string $content
|
|
|
|
*/
|
|
|
|
function setContent($content) {
|
|
|
|
$this->content = $content;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
function getContent() {
|
|
|
|
return $this->content;
|
|
|
|
}
|
2007-07-19 12:40:28 +02:00
|
|
|
|
|
|
|
function performReadonlyTransformation() {
|
2008-08-12 04:58:48 +02:00
|
|
|
$this->setReadonly(true);
|
2007-07-19 12:40:28 +02:00
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|