| 1 |
<?php if (! defined('ABSPATH')) exit; // Exit if accessed directly |
| 2 |
class HC3_Ui_Element_Input_Password extends HC3_Ui_Abstract_Input |
| 3 |
{ |
| 4 |
protected $el = 'input'; |
| 5 |
protected $uiType = 'input/password'; |
| 6 |
|
| 7 |
public function render() |
| 8 |
{ |
| 9 |
$out = $this->htmlFactory->makeElement('input') |
| 10 |
->addAttr('type', 'password' ) |
| 11 |
->addAttr('name', $this->htmlName() ) |
| 12 |
->addAttr('class', 'hc-field') |
| 13 |
// ->addAttr('class', 'hc-block') |
| 14 |
->addAttr('class', 'hc-full-width') |
| 15 |
; |
| 16 |
|
| 17 |
$attr = $this->getAttr(); |
| 18 |
foreach( $attr as $k => $v ){ |
| 19 |
$out->addAttr( $k, $v ); |
| 20 |
} |
| 21 |
|
| 22 |
$out->addAttr('id', $this->htmlId()); |
| 23 |
|
| 24 |
if( strlen($this->label) ){ |
| 25 |
$out |
| 26 |
->addAttr('placeholder', $this->label) |
| 27 |
; |
| 28 |
} |
| 29 |
|
| 30 |
if( strlen($this->label) ){ |
| 31 |
$out = $this->htmlFactory->makeLabelled( $this->label, $out, $this->htmlId() ); |
| 32 |
} |
| 33 |
|
| 34 |
return $out; |
| 35 |
} |
| 36 |
} |