Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 31 lines (27 sloc) 0.794 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
<?php

/**
* Simple label tag.
* This can be used to add extra text in your forms.
*/
class LabelField extends DatalessField {
protected $className;
protected $allowHTML;

/**
* Create a new label.
* @param title The label itslef
* @param class An HTML class to apply to the label.
*/
function __construct($title, $className = "", $allowHTML = false, $form = null) {
$this->className = $className;
$this->allowHTML = $allowHTML;

parent::__construct(null, $title, null, $form);
}

/**
* Returns a label containing the title, and an HTML class if given.
*/
function Field() {
$classClause = $this->className ? " class=\"$this->className\"" : '';
return "<label$classClause>" . ($this->allowHTML ? $this->title : htmlentities($this->title)) . "</label>";
}
}
?>
Something went wrong with that request. Please try again.