2007-07-19 12:40:28 +02:00
|
|
|
<?php
|
2008-01-09 05:18:36 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @package forms
|
|
|
|
* @subpackage fields-dataless
|
|
|
|
*/
|
|
|
|
|
2007-07-19 12:40:28 +02:00
|
|
|
/**
|
|
|
|
* Field that generates a heading tag.
|
|
|
|
* This can be used to add extra text in your forms.
|
2008-01-09 05:18:36 +01:00
|
|
|
* @package forms
|
|
|
|
* @subpackage fields-dataless
|
2007-07-19 12:40:28 +02:00
|
|
|
*/
|
|
|
|
class HeaderField extends DatalessField {
|
|
|
|
protected $headingLevel, $allowHTML;
|
|
|
|
|
|
|
|
function __construct($title, $headingLevel = 2, $allowHTML = false, $form = null) {
|
|
|
|
$this->headingLevel = $headingLevel;
|
|
|
|
$this->allowHTML = $allowHTML;
|
|
|
|
|
|
|
|
parent::__construct(null, $title, null, $form);
|
|
|
|
}
|
|
|
|
function Field() {
|
2007-11-23 02:10:19 +01:00
|
|
|
$XML_title = ($this->allowHTML) ? $this->title : Convert::raw2xml($this->title);
|
2007-07-19 12:40:28 +02:00
|
|
|
|
2007-11-23 02:10:19 +01:00
|
|
|
// extraclass
|
|
|
|
$XML_class = ($this->extraClass()) ? " class=\"{$this->extraClass()}\"" : '';
|
|
|
|
|
|
|
|
return "<h{$this->headingLevel}{$XML_class}>$XML_title</h$this->headingLevel>";
|
2007-07-19 12:40:28 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|