silverstripe-framework/forms/HeaderField.php
Hayden Smith 4a5d9b03f8 Moved Sapphire module to open source path
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@39001 467b73ca-7a2a-4603-9d3b-597d59a354a9
2007-07-19 10:40:28 +00:00

22 lines
599 B
PHP
Executable File

<?php
/**
* Field that generates a heading tag.
* This can be used to add extra text in your forms.
*/
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() {
if($this->allowHTML) $XML_title = $this->title;
else $XML_title = Convert::raw2xml($this->title);
return "<h$this->headingLevel>$XML_title</h$this->headingLevel>";
}
}
?>