@@ -5,12 +5,12 @@ |
||
5 | 5 | trait TextFieldsTrait { |
6 | 6 | |
7 | 7 | public abstract function getField(); |
8 | - public function setPlaceholder($value){ |
|
8 | + public function setPlaceholder($value) { |
|
9 | 9 | $this->getField()->setPlaceholder($value); |
10 | 10 | return $this; |
11 | 11 | } |
12 | 12 | |
13 | - public function setValue($value){ |
|
13 | + public function setValue($value) { |
|
14 | 14 | $this->getField()->setValue($value); |
15 | 15 | return $this; |
16 | 16 | } |
@@ -11,51 +11,51 @@ |
||
11 | 11 | |
12 | 12 | public abstract function addToProperty($name, $value, $separator=" "); |
13 | 13 | public abstract function addLabel($caption, $style="label-default", $leftSeparator=" "); |
14 | - public abstract function addContent($content,$before=false); |
|
14 | + public abstract function addContent($content, $before=false); |
|
15 | 15 | public function setFocus() { |
16 | 16 | $this->addToProperty("class", State::FOCUS); |
17 | 17 | } |
18 | 18 | |
19 | 19 | public function addLoading() { |
20 | - if ($this->_hasIcon === false) { |
|
20 | + if ($this->_hasIcon===false) { |
|
21 | 21 | throw new \Exception("Input must have an icon for showing a loader, use addIcon before"); |
22 | 22 | } |
23 | 23 | return $this->addToProperty("class", State::LOADING); |
24 | 24 | } |
25 | 25 | |
26 | 26 | public function labeled($label, $direction=Direction::LEFT, $icon=NULL) { |
27 | - $labelO=$this->addLabel($label,$direction===Direction::LEFT,$icon); |
|
28 | - $this->addToProperty("class", $direction . " labeled"); |
|
27 | + $labelO=$this->addLabel($label, $direction===Direction::LEFT, $icon); |
|
28 | + $this->addToProperty("class", $direction." labeled"); |
|
29 | 29 | return $labelO; |
30 | 30 | } |
31 | 31 | |
32 | 32 | public function labeledToCorner($icon, $direction=Direction::LEFT) { |
33 | - return $this->labeled("", $direction . " corner", $icon)->toCorner($direction); |
|
33 | + return $this->labeled("", $direction." corner", $icon)->toCorner($direction); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | public function addAction($action, $direction=Direction::RIGHT, $icon=NULL, $labeled=false) { |
37 | 37 | $actionO=$action; |
38 | - if (\is_object($action) === false) { |
|
39 | - $actionO=new HtmlButton("action-" . $this->identifier, $action); |
|
38 | + if (\is_object($action)===false) { |
|
39 | + $actionO=new HtmlButton("action-".$this->identifier, $action); |
|
40 | 40 | if (isset($icon)) |
41 | 41 | $actionO->addIcon($icon, true, $labeled); |
42 | 42 | } |
43 | - $this->addToProperty("class", $direction . " action"); |
|
44 | - $this->addContent($actionO, \strstr($direction, Direction::LEFT) !== false); |
|
43 | + $this->addToProperty("class", $direction." action"); |
|
44 | + $this->addContent($actionO, \strstr($direction, Direction::LEFT)!==false); |
|
45 | 45 | return $actionO; |
46 | 46 | } |
47 | 47 | |
48 | - public function addDropdown($label="", $items=array(),$direction=Direction::RIGHT){ |
|
49 | - $labelO=new HtmlDropdown("dd-".$this->identifier,$label,$items); |
|
50 | - $labelO->asSelect("select-".$this->identifier,false,true); |
|
51 | - return $this->labeled($labelO,$direction); |
|
48 | + public function addDropdown($label="", $items=array(), $direction=Direction::RIGHT) { |
|
49 | + $labelO=new HtmlDropdown("dd-".$this->identifier, $label, $items); |
|
50 | + $labelO->asSelect("select-".$this->identifier, false, true); |
|
51 | + return $this->labeled($labelO, $direction); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | public function setTransparent() { |
55 | 55 | return $this->addToProperty("class", "transparent"); |
56 | 56 | } |
57 | 57 | |
58 | - public function setReadonly(){ |
|
58 | + public function setReadonly() { |
|
59 | 59 | $this->getField()->setProperty("readonly", ""); |
60 | 60 | } |
61 | 61 |
@@ -7,11 +7,11 @@ |
||
7 | 7 | use Ajax\semantic\html\collections\form\traits\FieldTrait; |
8 | 8 | |
9 | 9 | class HtmlFormInput extends HtmlFormField { |
10 | - use TextFieldsTrait,FieldTrait; |
|
10 | + use TextFieldsTrait, FieldTrait; |
|
11 | 11 | |
12 | - public function __construct($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL) { |
|
13 | - if(!isset($placeholder) && $type==="text") |
|
12 | + public function __construct($identifier, $label=NULL, $type="text", $value=NULL, $placeholder=NULL) { |
|
13 | + if (!isset($placeholder) && $type==="text") |
|
14 | 14 | $placeholder=$label; |
15 | - parent::__construct("field-".$identifier, new HtmlInput($identifier,$type,$value,$placeholder), $label); |
|
15 | + parent::__construct("field-".$identifier, new HtmlInput($identifier, $type, $value, $placeholder), $label); |
|
16 | 16 | } |
17 | 17 | } |
18 | 18 | \ No newline at end of file |
@@ -9,13 +9,13 @@ |
||
9 | 9 | use Ajax\semantic\html\collections\form\traits\FieldTrait; |
10 | 10 | |
11 | 11 | class HtmlInput extends HtmlSemDoubleElement { |
12 | - use IconTrait,TextFieldsTrait,FieldTrait; |
|
12 | + use IconTrait, TextFieldsTrait, FieldTrait; |
|
13 | 13 | |
14 | 14 | public function __construct($identifier, $type="text", $value="", $placeholder="") { |
15 | - parent::__construct("div-" . $identifier, "div", "ui input"); |
|
16 | - $this->content=[ "field" => new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder) ]; |
|
17 | - $this->_states=[ State::DISABLED,State::FOCUS,State::ERROR ]; |
|
18 | - $this->_variations=[ Variation::TRANSPARENT ]; |
|
15 | + parent::__construct("div-".$identifier, "div", "ui input"); |
|
16 | + $this->content=["field" => new \Ajax\common\html\html5\HtmlInput($identifier, $type, $value, $placeholder)]; |
|
17 | + $this->_states=[State::DISABLED, State::FOCUS, State::ERROR]; |
|
18 | + $this->_variations=[Variation::TRANSPARENT]; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | public function getField() { |