@@ -7,9 +7,16 @@ |
||
7 | 7 | trait IconTrait { |
8 | 8 | private $_hasIcon=false; |
9 | 9 | |
10 | + /** |
|
11 | + * @param string $name |
|
12 | + * @param string $value |
|
13 | + */ |
|
10 | 14 | protected abstract function addToPropertyCtrl($name, $value, $typeCtrl); |
11 | 15 | public abstract function addContent($content,$before=false); |
12 | 16 | |
17 | + /** |
|
18 | + * @param boolean $direction |
|
19 | + */ |
|
13 | 20 | public function addIcon($icon,$direction=Direction::LEFT){ |
14 | 21 | if($this->_hasIcon===false){ |
15 | 22 | $iconO=$icon; |
@@ -8,18 +8,18 @@ discard block |
||
8 | 8 | private $_hasIcon=false; |
9 | 9 | |
10 | 10 | protected abstract function addToPropertyCtrl($name, $value, $typeCtrl); |
11 | - public abstract function addContent($content,$before=false); |
|
11 | + public abstract function addContent($content, $before=false); |
|
12 | 12 | |
13 | - public function addIcon($icon,$direction=Direction::LEFT){ |
|
14 | - if($this->_hasIcon===false){ |
|
13 | + public function addIcon($icon, $direction=Direction::LEFT) { |
|
14 | + if ($this->_hasIcon===false) { |
|
15 | 15 | $iconO=$icon; |
16 | - if(\is_string($icon)){ |
|
16 | + if (\is_string($icon)) { |
|
17 | 17 | $iconO=new HtmlIcon("icon-".$this->identifier, $icon); |
18 | 18 | } |
19 | 19 | $this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon")); |
20 | - $this->addContent($iconO,false); |
|
20 | + $this->addContent($iconO, false); |
|
21 | 21 | $this->_hasIcon=true; |
22 | - }else{ |
|
22 | + }else { |
|
23 | 23 | $iconO=$this->getIcon(); |
24 | 24 | $iconO->setIcon($icon); |
25 | 25 | $this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon")); |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | return $iconO; |
28 | 28 | } |
29 | 29 | |
30 | - public function getIcon(){ |
|
31 | - if(\is_array($this->content)){ |
|
32 | - foreach ($this->content as $item){ |
|
33 | - if($item instanceof HtmlIcon) |
|
30 | + public function getIcon() { |
|
31 | + if (\is_array($this->content)) { |
|
32 | + foreach ($this->content as $item) { |
|
33 | + if ($item instanceof HtmlIcon) |
|
34 | 34 | return $item; |
35 | 35 | } |
36 | 36 | } |
@@ -16,6 +16,9 @@ |
||
16 | 16 | |
17 | 17 | trait BootstrapComponentsTrait { |
18 | 18 | |
19 | + /** |
|
20 | + * @param string|null $attachTo |
|
21 | + */ |
|
19 | 22 | public abstract function addComponent(SimpleComponent $component, $attachTo, $params); |
20 | 23 | /** |
21 | 24 | * |
@@ -9,26 +9,26 @@ discard block |
||
9 | 9 | use Ajax\semantic\html\collections\form\HtmlFormCheckbox; |
10 | 10 | use Ajax\semantic\html\collections\form\HtmlFormRadio; |
11 | 11 | trait FieldsTrait { |
12 | - public abstract function addFields($fields=NULL,$label=NULL); |
|
12 | + public abstract function addFields($fields=NULL, $label=NULL); |
|
13 | 13 | public abstract function addItem($item); |
14 | 14 | |
15 | - protected function createItem($value){ |
|
16 | - if(\is_array($value)){ |
|
17 | - $itemO=new HtmlFormInput(JArray::getDefaultValue($value, "id",""),JArray::getDefaultValue($value, "label",null),JArray::getDefaultValue($value, "type", "text"),JArray::getDefaultValue($value, "value",""),JArray::getDefaultValue($value, "placeholder",JArray::getDefaultValue($value, "label",null))); |
|
15 | + protected function createItem($value) { |
|
16 | + if (\is_array($value)) { |
|
17 | + $itemO=new HtmlFormInput(JArray::getDefaultValue($value, "id", ""), JArray::getDefaultValue($value, "label", null), JArray::getDefaultValue($value, "type", "text"), JArray::getDefaultValue($value, "value", ""), JArray::getDefaultValue($value, "placeholder", JArray::getDefaultValue($value, "label", null))); |
|
18 | 18 | return $itemO; |
19 | 19 | }else |
20 | 20 | return new HtmlFormInput($value); |
21 | 21 | } |
22 | 22 | |
23 | - public function addInputs($inputs,$fieldslabel=null){ |
|
23 | + public function addInputs($inputs, $fieldslabel=null) { |
|
24 | 24 | $fields=array(); |
25 | - foreach ($inputs as $input){ |
|
25 | + foreach ($inputs as $input) { |
|
26 | 26 | \extract($input); |
27 | - $f=new HtmlFormInput("",""); |
|
27 | + $f=new HtmlFormInput("", ""); |
|
28 | 28 | $f->fromArray($input); |
29 | 29 | $fields[]=$f; |
30 | 30 | } |
31 | - return $this->addFields($fields,$fieldslabel); |
|
31 | + return $this->addFields($fields, $fieldslabel); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -39,23 +39,23 @@ discard block |
||
39 | 39 | * @param boolean $multiple |
40 | 40 | * @return \Ajax\common\html\HtmlDoubleElement |
41 | 41 | */ |
42 | - public function addDropdown($identifier,$items=array(), $label=NULL,$value=NULL,$multiple=false){ |
|
43 | - return $this->addItem(new HtmlFormDropdown($identifier,$items,$label,$value,$multiple)); |
|
42 | + public function addDropdown($identifier, $items=array(), $label=NULL, $value=NULL, $multiple=false) { |
|
43 | + return $this->addItem(new HtmlFormDropdown($identifier, $items, $label, $value, $multiple)); |
|
44 | 44 | } |
45 | 45 | |
46 | - public function addInput($identifier, $label=NULL,$type="text",$value=NULL,$placeholder=NULL){ |
|
47 | - return $this->addItem(new HtmlFormInput($identifier,$label,$type,$value,$placeholder)); |
|
46 | + public function addInput($identifier, $label=NULL, $type="text", $value=NULL, $placeholder=NULL) { |
|
47 | + return $this->addItem(new HtmlFormInput($identifier, $label, $type, $value, $placeholder)); |
|
48 | 48 | } |
49 | 49 | |
50 | - public function addButton($identifier,$value,$cssStyle=NULL,$onClick=NULL){ |
|
51 | - return $this->addItem(new HtmlButton($identifier,$value,$cssStyle,$onClick)); |
|
50 | + public function addButton($identifier, $value, $cssStyle=NULL, $onClick=NULL) { |
|
51 | + return $this->addItem(new HtmlButton($identifier, $value, $cssStyle, $onClick)); |
|
52 | 52 | } |
53 | 53 | |
54 | - public function addCheckbox($identifier, $label=NULL,$value=NULL,$type=NULL){ |
|
55 | - return $this->addItem(new HtmlFormCheckbox($identifier,$label,$value,$type)); |
|
54 | + public function addCheckbox($identifier, $label=NULL, $value=NULL, $type=NULL) { |
|
55 | + return $this->addItem(new HtmlFormCheckbox($identifier, $label, $value, $type)); |
|
56 | 56 | } |
57 | 57 | |
58 | - public function addRadio($identifier, $name,$label=NULL,$value=NULL){ |
|
59 | - return $this->addItem(new HtmlFormRadio($identifier,$name,$label,$value)); |
|
58 | + public function addRadio($identifier, $name, $label=NULL, $value=NULL) { |
|
59 | + return $this->addItem(new HtmlFormRadio($identifier, $name, $label, $value)); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | \ No newline at end of file |