1 <?php
2 3 4 5 6 7 8 9
10 class LabelField extends DatalessField {
11
12 13 14 15 16 17 18
19 function __construct($name, $title, $className = null, $allowHTML = false, $form = null) {
20
21
22 $args = func_get_args();
23 if(!isset($args[1])) {
24 $title = (isset($args[0])) ? $args[0] : null;
25 $name = $title;
26 $classname = (isset($args[1])) ? $args[1] : null;
27 $allowHTML = (isset($args[2])) ? $args[2] : null;
28 $form = (isset($args[3])) ? $args[3] : null;
29 }
30
31 parent::__construct($name, $title, null, $allowHTML, $form);
32 }
33
34 35 36
37 function Field() {
38 $attributes = array(
39 'class' => $this->extraClass(),
40 'id' => $this->id()
41 );
42 return $this->createTag(
43 'label',
44 $attributes,
45 ($this->getAllowHTML() ? $this->title : htmlspecialchars($this->title))
46 );
47 }
48 }
49 ?>
[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the
Silverstripe Forums to ask development related questions.
-