summaryrefslogtreecommitdiffstats
path: root/vendor/ipl/web/src/Layout/Controls.php
blob: 87637755c8fedb79915b65748bf961982fddd5d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php

namespace ipl\Web\Layout;

use ipl\Html\BaseHtmlElement;
use ipl\Web\Widget\Tabs;

/**
 * Container for controls
 */
class Controls extends BaseHtmlElement
{
    /** @var Tabs */
    protected $tabs;

    protected $contentSeparator = "\n";

    protected $defaultAttributes = ['class' => 'controls'];

    protected $tag = 'div';

    /**
     * Get the tabs
     *
     * @return Tabs
     */
    public function getTabs()
    {
        return $this->tabs;
    }

    /**
     * Set the tabs
     *
     * @param Tabs $tabs
     *
     * @return $this
     */
    public function setTabs(Tabs $tabs)
    {
        $this->tabs = $tabs;

        return $this;
    }

    public function isEmpty()
    {
        if (! parent::isEmpty()) {
            return false;
        }

        return $this->tabs->count() === 0;
    }

    protected function assemble()
    {
        $this->prepend($this->getTabs());
    }
}