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