| 1 |
<?php |
| 2 |
|
| 3 |
namespace ipl\Web\Layout; |
| 4 |
|
| 5 |
use ipl\Html\BaseHtmlElement; |
| 6 |
use ipl\Web\Widget\Tabs; |
| 7 |
|
| 8 |
/** |
| 9 |
* Container for controls |
| 10 |
*/ |
| 11 |
class Controls extends BaseHtmlElement |
| 12 |
{ |
| 13 |
/** @var Tabs */ |
| 14 |
protected $tabs; |
| 15 |
|
| 16 |
protected $contentSeparator = "\n"; |
| 17 |
|
| 18 |
protected $defaultAttributes = ['class' => 'controls']; |
| 19 |
|
| 20 |
protected $tag = 'div'; |
| 21 |
|
| 22 |
/** |
| 23 |
* Get the tabs |
| 24 |
* |
| 25 |
* @return Tabs |
| 26 |
*/ |
| 27 |
public function getTabs() |
| 28 |
{ |
| 29 |
return $this->tabs; |
| 30 |
} |
| 31 |
|
| 32 |
/** |
| 33 |
* Set the tabs |
| 34 |
* |
| 35 |
* @param Tabs $tabs |
| 36 |
* |
| 37 |
* @return $this |
| 38 |
*/ |
| 39 |
public function setTabs(Tabs $tabs) |
| 40 |
{ |
| 41 |
$this->tabs = $tabs; |
| 42 |
|
| 43 |
return $this; |
| 44 |
} |
| 45 |
|
| 46 |
public function isEmpty(): bool |
| 47 |
{ |
| 48 |
if (! parent::isEmpty()) { |
| 49 |
return false; |
| 50 |
} |
| 51 |
|
| 52 |
return $this->tabs->count() === 0; |
| 53 |
} |
| 54 |
|
| 55 |
protected function assemble() |
| 56 |
{ |
| 57 |
$this->prepend($this->getTabs()); |
| 58 |
} |
| 59 |
} |