@@ -10,13 +10,16 @@ |
||
| 10 | 10 | |
| 11 | 11 | class HtmlLabel extends HtmlSemDoubleElement { |
| 12 | 12 | use LabeledIconTrait; |
| 13 | + |
|
| 14 | + /** |
|
| 15 | + * @param string $identifier |
|
| 16 | + */ |
|
| 13 | 17 | public function __construct($identifier,$caption="",$tagName="div") { |
| 14 | 18 | parent::__construct($identifier,$tagName,"ui label"); |
| 15 | 19 | $this->content=$caption; |
| 16 | 20 | } |
| 17 | 21 | |
| 18 | 22 | /** |
| 19 | - * @param string $side |
|
| 20 | 23 | * @return \Ajax\semantic\html\elements\HtmlLabel |
| 21 | 24 | */ |
| 22 | 25 | public function setPointing($value=Direction::NONE){ |
@@ -11,8 +11,9 @@ |
||
| 11 | 11 | parent::__construct($identifier, "input"); |
| 12 | 12 | $this->setProperty("name", $identifier); |
| 13 | 13 | $this->setProperty("value", $value); |
| 14 | - if(JString::isNotNull($placeholder)) |
|
| 15 | - $this->setProperty("placeholder", $placeholder); |
|
| 14 | + if(JString::isNotNull($placeholder)) { |
|
| 15 | + $this->setProperty("placeholder", $placeholder); |
|
| 16 | + } |
|
| 16 | 17 | $this->setProperty("type", $type); |
| 17 | 18 | } |
| 18 | 19 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon")); |
| 30 | 30 | $this->addContent($iconO,false); |
| 31 | 31 | $this->_hasIcon=true; |
| 32 | - }else{ |
|
| 32 | + } else{ |
|
| 33 | 33 | $iconO=$this->getIcon(); |
| 34 | 34 | $iconO->setIcon($icon); |
| 35 | 35 | $this->addToPropertyCtrl("class", $direction." icon", Direction::getConstantValues("icon")); |
@@ -40,8 +40,9 @@ discard block |
||
| 40 | 40 | public function getIcon(){ |
| 41 | 41 | if(\is_array($this->content)){ |
| 42 | 42 | foreach ($this->content as $item){ |
| 43 | - if($item instanceof HtmlIcon) |
|
| 44 | - return $item; |
|
| 43 | + if($item instanceof HtmlIcon) { |
|
| 44 | + return $item; |
|
| 45 | + } |
|
| 45 | 46 | } |
| 46 | 47 | } |
| 47 | 48 | } |
@@ -57,9 +58,10 @@ discard block |
||
| 57 | 58 | $labelO=$label; |
| 58 | 59 | if(\is_object($label)===false){ |
| 59 | 60 | $labelO=new HtmlLabel("label-".$this->identifier,$label); |
| 60 | - if(isset($icon)) |
|
| 61 | - $labelO->addIcon($icon); |
|
| 62 | - }else{ |
|
| 61 | + if(isset($icon)) { |
|
| 62 | + $labelO->addIcon($icon); |
|
| 63 | + } |
|
| 64 | + } else{ |
|
| 63 | 65 | $labelO->addToPropertyCtrl("class", "label", array("label")); |
| 64 | 66 | } |
| 65 | 67 | $this->addToProperty("class", $direction." labeled"); |
@@ -75,8 +77,9 @@ discard block |
||
| 75 | 77 | $actionO=$action; |
| 76 | 78 | if(\is_object($action)===false){ |
| 77 | 79 | $actionO=new HtmlButton("action-".$this->identifier,$action); |
| 78 | - if(isset($icon)) |
|
| 79 | - $actionO->addIcon($icon,true,$labeled); |
|
| 80 | + if(isset($icon)) { |
|
| 81 | + $actionO->addIcon($icon,true,$labeled); |
|
| 82 | + } |
|
| 80 | 83 | } |
| 81 | 84 | $this->addToProperty("class", $direction." action"); |
| 82 | 85 | $this->addContent($actionO,\strstr($direction,Direction::LEFT)!==false); |