@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | public function setFocusable($value=true) { |
59 | - if ($value === true) |
|
60 | - $this->setProperty("tabindex", "0"); |
|
61 | - else { |
|
59 | + if ($value === true) { |
|
60 | + $this->setProperty("tabindex", "0"); |
|
61 | + } else { |
|
62 | 62 | $this->removeProperty("tabindex"); |
63 | 63 | } |
64 | 64 | return $this; |
@@ -106,8 +106,9 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function addLabel($label, $before=false, $icon=NULL) { |
108 | 108 | $this->tagName="div";$prefix=""; |
109 | - if($before) |
|
110 | - $prefix="left "; |
|
109 | + if($before) { |
|
110 | + $prefix="left "; |
|
111 | + } |
|
111 | 112 | $this->addToProperty("class", $prefix."labeled"); |
112 | 113 | $isIcon=(isset($this->content[0]) && $this->content[0] instanceof HtmlIcon); |
113 | 114 | $this->content=new HtmlButton("button-" . $this->identifier, $this->content); |
@@ -144,12 +145,13 @@ discard block |
||
144 | 145 | public function setColor($color){ |
145 | 146 | if(\is_array($this->content)){ |
146 | 147 | foreach ($this->content as $content){ |
147 | - if($content instanceof HtmlButton) |
|
148 | - $content->setColor($color); |
|
148 | + if($content instanceof HtmlButton) { |
|
149 | + $content->setColor($color); |
|
150 | + } |
|
149 | 151 | } |
152 | + } else { |
|
153 | + parent::setColor($color); |
|
150 | 154 | } |
151 | - else |
|
152 | - parent::setColor($color); |
|
153 | 155 | return $this; |
154 | 156 | } |
155 | 157 | |
@@ -202,8 +204,9 @@ discard block |
||
202 | 204 | * @return HtmlButton |
203 | 205 | */ |
204 | 206 | public static function social($identifier, $social, $value=NULL) { |
205 | - if ($value === NULL) |
|
206 | - $value=\ucfirst($social); |
|
207 | + if ($value === NULL) { |
|
208 | + $value=\ucfirst($social); |
|
209 | + } |
|
207 | 210 | $return=new HtmlButton($identifier, $value); |
208 | 211 | $return->addIcon($social); |
209 | 212 | return $return->addToPropertyCtrl("class", $social, Social::getConstants()); |
@@ -256,8 +259,9 @@ discard block |
||
256 | 259 | public static function dropdown($identifier,$value,$items=[],$asCombo=false,$icon=null){ |
257 | 260 | $result=new HtmlButtonGroups($identifier,[$value]); |
258 | 261 | $dd=$result->addDropdown($items,$asCombo); |
259 | - if(isset($icon) && $dd instanceof HtmlDropdown) |
|
260 | - $dd->setIcon($icon); |
|
262 | + if(isset($icon) && $dd instanceof HtmlDropdown) { |
|
263 | + $dd->setIcon($icon); |
|
264 | + } |
|
261 | 265 | return $result; |
262 | 266 | } |
263 | 267 | } |
@@ -18,8 +18,9 @@ discard block |
||
18 | 18 | protected $_dropdown; |
19 | 19 | public function __construct($identifier, $elements=array(), $asIcons=false) { |
20 | 20 | parent::__construct($identifier, "div", "ui buttons"); |
21 | - if ($asIcons === true) |
|
22 | - $this->asIcons(); |
|
21 | + if ($asIcons === true) { |
|
22 | + $this->asIcons(); |
|
23 | + } |
|
23 | 24 | $this->addElements($elements, $asIcons); |
24 | 25 | } |
25 | 26 | protected function createItem($value){ |
@@ -50,8 +51,9 @@ discard block |
||
50 | 51 | */ |
51 | 52 | public function addElement($element, $asIcon=false) { |
52 | 53 | $item=$this->addItem($element); |
53 | - if($asIcon && $item instanceof HtmlButton) |
|
54 | - $item->asIcon($element); |
|
54 | + if($asIcon && $item instanceof HtmlButton) { |
|
55 | + $item->asIcon($element); |
|
56 | + } |
|
55 | 57 | return $item; |
56 | 58 | } |
57 | 59 | |
@@ -79,8 +81,9 @@ discard block |
||
79 | 81 | |
80 | 82 | public function asIcons() { |
81 | 83 | foreach ( $this->content as $item ) { |
82 | - if($item instanceof HtmlButton) |
|
83 | - $item->asIcon($item->getContent()); |
|
84 | + if($item instanceof HtmlButton) { |
|
85 | + $item->asIcon($item->getContent()); |
|
86 | + } |
|
84 | 87 | } |
85 | 88 | return $this->addToProperty("class", "icons"); |
86 | 89 | } |
@@ -92,8 +95,9 @@ discard block |
||
92 | 95 | */ |
93 | 96 | public function addIcons($icons){ |
94 | 97 | foreach ( $this->content as $index=>$item ) { |
95 | - if($item instanceof HtmlButton && isset($icons[$index])) |
|
96 | - $item->addIcon($icons[$index]); |
|
98 | + if($item instanceof HtmlButton && isset($icons[$index])) { |
|
99 | + $item->addIcon($icons[$index]); |
|
100 | + } |
|
97 | 101 | } |
98 | 102 | return $this; |
99 | 103 | } |