@@ -7,17 +7,17 @@ discard block |
||
7 | 7 | class HtmlFormInput extends HtmlFormField { |
8 | 8 | use TextFieldsTrait; |
9 | 9 | |
10 | - public function __construct($identifier, $label = NULL, $type = "text", $value = NULL, $placeholder = NULL) { |
|
11 | - if (! isset($placeholder) && $type === "text") |
|
12 | - $placeholder = $label; |
|
13 | - parent::__construct("field-" . $identifier, new HtmlInput($identifier, $type, $value, $placeholder), $label); |
|
14 | - $this->_identifier = $identifier; |
|
10 | + public function __construct($identifier, $label=NULL, $type="text", $value=NULL, $placeholder=NULL) { |
|
11 | + if (!isset($placeholder) && $type==="text") |
|
12 | + $placeholder=$label; |
|
13 | + parent::__construct("field-".$identifier, new HtmlInput($identifier, $type, $value, $placeholder), $label); |
|
14 | + $this->_identifier=$identifier; |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | public function getDataField() { |
18 | - $field = $this->getField(); |
|
18 | + $field=$this->getField(); |
|
19 | 19 | if ($field instanceof HtmlInput) |
20 | - $field = $field->getDataField(); |
|
20 | + $field=$field->getDataField(); |
|
21 | 21 | return $field; |
22 | 22 | } |
23 | 23 | |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @param string $keyIcon |
28 | 28 | */ |
29 | - public function asPassword($keyIcon = 'key') { |
|
29 | + public function asPassword($keyIcon='key') { |
|
30 | 30 | $this->setInputType('password'); |
31 | - if ($keyIcon != '') { |
|
31 | + if ($keyIcon!='') { |
|
32 | 32 | $this->addIcon($keyIcon); |
33 | 33 | } |
34 | 34 | } |
@@ -41,11 +41,11 @@ discard block |
||
41 | 41 | * @param string $slashIcon |
42 | 42 | * @return mixed|\Ajax\semantic\html\elements\HtmlButton |
43 | 43 | */ |
44 | - public function addTogglePasswordAction($buttonIcon = 'eye', $keyIcon = 'key', $slashIcon = 'slash') { |
|
44 | + public function addTogglePasswordAction($buttonIcon='eye', $keyIcon='key', $slashIcon='slash') { |
|
45 | 45 | $this->asPassword($keyIcon); |
46 | - $action = $this->addAction('see'); |
|
46 | + $action=$this->addAction('see'); |
|
47 | 47 | $action->asIcon($buttonIcon); |
48 | - $action->onClick('$(this).find(".icon").toggleClass("' . $slashIcon . '");$(this).closest(".field").find("input").attr("type",(_,attr)=>(attr=="text")?"password":"text")'); |
|
48 | + $action->onClick('$(this).find(".icon").toggleClass("'.$slashIcon.'");$(this).closest(".field").find("input").attr("type",(_,attr)=>(attr=="text")?"password":"text")'); |
|
49 | 49 | return $action; |
50 | 50 | } |
51 | 51 | } |