@@ -8,26 +8,26 @@ discard block |
||
8 | 8 | |
9 | 9 | class HtmlFormField extends HtmlSemDoubleElement { |
10 | 10 | protected $_container; |
11 | - public function __construct($identifier, $field,$label=NULL) { |
|
12 | - parent::__construct($identifier, "div","field"); |
|
11 | + public function __construct($identifier, $field, $label=NULL) { |
|
12 | + parent::__construct($identifier, "div", "field"); |
|
13 | 13 | $this->content=array(); |
14 | - $this->_states=[State::ERROR,State::DISABLED]; |
|
15 | - if(isset($label)) |
|
14 | + $this->_states=[State::ERROR, State::DISABLED]; |
|
15 | + if (isset($label)) |
|
16 | 16 | $this->setLabel($label); |
17 | 17 | $this->setField($field); |
18 | 18 | } |
19 | 19 | |
20 | - public function setLabel($label){ |
|
20 | + public function setLabel($label) { |
|
21 | 21 | $labelO=$label; |
22 | - if(\is_string($label)){ |
|
23 | - $labelO=new HtmlSemDoubleElement("","label"); |
|
22 | + if (\is_string($label)) { |
|
23 | + $labelO=new HtmlSemDoubleElement("", "label"); |
|
24 | 24 | $labelO->setContent($label); |
25 | - $labelO->setProperty("for", \str_replace("field-", "",$this->identifier)); |
|
25 | + $labelO->setProperty("for", \str_replace("field-", "", $this->identifier)); |
|
26 | 26 | } |
27 | 27 | $this->content["label"]=$labelO; |
28 | 28 | } |
29 | 29 | |
30 | - public function setField($field){ |
|
30 | + public function setField($field) { |
|
31 | 31 | $this->content["field"]=$field; |
32 | 32 | } |
33 | 33 | |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | * Returns the label or null |
36 | 36 | * @return mixed |
37 | 37 | */ |
38 | - public function getLabel(){ |
|
39 | - if(\array_key_exists("label", $this->content)) |
|
38 | + public function getLabel() { |
|
39 | + if (\array_key_exists("label", $this->content)) |
|
40 | 40 | return $this->content["label"]; |
41 | 41 | } |
42 | 42 | |
@@ -44,14 +44,14 @@ discard block |
||
44 | 44 | * Return the field |
45 | 45 | * @return mixed |
46 | 46 | */ |
47 | - public function getField(){ |
|
47 | + public function getField() { |
|
48 | 48 | return $this->content["field"]; |
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
52 | 52 | * puts the label before or behind |
53 | 53 | */ |
54 | - public function swapLabel(){ |
|
54 | + public function swapLabel() { |
|
55 | 55 | $label=$this->getLabel(); |
56 | 56 | unset($this->content["label"]); |
57 | 57 | $this->content["label"]=$label; |
@@ -62,27 +62,27 @@ discard block |
||
62 | 62 | * @param int $width |
63 | 63 | * @return \Ajax\semantic\html\collections\form\HtmlFormField |
64 | 64 | */ |
65 | - public function setWidth($width){ |
|
66 | - if(\is_int($width)){ |
|
65 | + public function setWidth($width) { |
|
66 | + if (\is_int($width)) { |
|
67 | 67 | $width=Wide::getConstants()["W".$width]; |
68 | 68 | } |
69 | 69 | $this->addToPropertyCtrl("class", $width, Wide::getConstants()); |
70 | - if(isset($this->_container)){ |
|
70 | + if (isset($this->_container)) { |
|
71 | 71 | $this->_container->setEqualWidth(false); |
72 | 72 | } |
73 | - return $this->addToPropertyCtrl("class", "wide",array("wide")); |
|
73 | + return $this->addToPropertyCtrl("class", "wide", array("wide")); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
77 | 77 | * Field displays an error state |
78 | 78 | * @return \Ajax\semantic\html\collections\form\HtmlFormField |
79 | 79 | */ |
80 | - public function setError(){ |
|
80 | + public function setError() { |
|
81 | 81 | return $this->addToProperty("class", "error"); |
82 | 82 | } |
83 | 83 | |
84 | - public function jsState($state){ |
|
85 | - return $this->jsDoJquery("addClass",$state); |
|
84 | + public function jsState($state) { |
|
85 | + return $this->jsDoJquery("addClass", $state); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | public function setContainer($_container) { |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | return $this; |
91 | 91 | } |
92 | 92 | |
93 | - public function setReadonly(){ |
|
93 | + public function setReadonly() { |
|
94 | 94 | $this->getField()->setProperty("readonly", ""); |
95 | 95 | } |
96 | 96 |