to
HTML tag. Default: 2
*/
protected $headingLevel = 2;
function __construct($name, $title = null, $headingLevel = 2, $allowHTML = false, $form = null) {
// legacy handling for old parameters: $title, $heading, ...
// instead of new handling: $name, $title, $heading, ...
$args = func_get_args();
if(!isset($args[1]) || is_numeric($args[1])) {
$title = (isset($args[0])) ? $args[0] : null;
$name = $title; // this means i18nized fields won't be easily accessible through fieldByName()
$headingLevel = (isset($args[1])) ? $args[1] : null;
$allowHTML = (isset($args[2])) ? $args[2] : null;
$form = (isset($args[3])) ? $args[3] : null;
}
if($headingLevel) $this->headingLevel = $headingLevel;
$this->allowHTML = $allowHTML;
parent::__construct($name, $title, null, $allowHTML, $form);
}
function Field() {
$attributes = array(
'class' => $this->extraClass(),
'id' => $this->id(),
'name' => $this->Name(),
);
return $this->createTag(
"h{$this->headingLevel}",
$attributes,
($this->getAllowHTML() ? $this->title : Convert::raw2xml($this->title))
);
}
}
?>