| 1 |
<?php if (! defined('ABSPATH')) exit; // Exit if accessed directly |
| 2 |
class HC3_Ui_Element_LabelledInline extends HC3_Ui_Abstract_Collection |
| 3 |
{ |
| 4 |
protected $htmlFactory = NULL; |
| 5 |
protected $label = NULL; |
| 6 |
protected $content = NULL; |
| 7 |
|
| 8 |
public function __construct( HC3_Ui $html, $label, $content, $labelFor = NULL ) |
| 9 |
{ |
| 10 |
$this->htmlFactory = $html; |
| 11 |
$this->label = $label; |
| 12 |
$this->content = $content; |
| 13 |
$this->labelFor = $labelFor; |
| 14 |
|
| 15 |
$this->add( $this->label ); |
| 16 |
$this->add( $this->content ); |
| 17 |
} |
| 18 |
|
| 19 |
public function render() |
| 20 |
{ |
| 21 |
// $labelView = $this->htmlFactory->makeElement('label', $this->label); |
| 22 |
$labelView = $this->htmlFactory->makeBlock( $this->label ); |
| 23 |
|
| 24 |
// if( strlen($this->labelFor) ){ |
| 25 |
// $labelView->addAttr('for', $this->labelFor ); |
| 26 |
// } |
| 27 |
|
| 28 |
$labelView |
| 29 |
->addAttr('class', 'hc-fs2') |
| 30 |
->addAttr('class', 'hc-muted2') |
| 31 |
// ->addAttr('class', 'hc-mt1') |
| 32 |
; |
| 33 |
|
| 34 |
$contentView = $this->htmlFactory->makeBlock( $this->content ); |
| 35 |
// $contentView |
| 36 |
// ->addAttr('class', 'hc-bold') |
| 37 |
// ; |
| 38 |
|
| 39 |
$out = $this->htmlFactory->makeListInline( array($labelView, $contentView) ) |
| 40 |
->gutter(1) |
| 41 |
; |
| 42 |
|
| 43 |
return $out; |
| 44 |
} |
| 45 |
} |