@@ 42-56 (lines=15) @@ | ||
39 | * |
|
40 | * @return $this |
|
41 | */ |
|
42 | public function add($title, $content, $active = false) |
|
43 | { |
|
44 | $this->data['tabs'][] = [ |
|
45 | 'id' => mt_rand(), |
|
46 | 'title' => $title, |
|
47 | 'content' => $content, |
|
48 | 'type' => static::TYPE_CONTENT, |
|
49 | ]; |
|
50 | ||
51 | if ($active) { |
|
52 | $this->data['active'] = count($this->data['tabs']) - 1; |
|
53 | } |
|
54 | ||
55 | return $this; |
|
56 | } |
|
57 | ||
58 | /** |
|
59 | * Add a link on tab. |
|
@@ 67-81 (lines=15) @@ | ||
64 | * |
|
65 | * @return $this |
|
66 | */ |
|
67 | public function addLink($title, $href, $active = false) |
|
68 | { |
|
69 | $this->data['tabs'][] = [ |
|
70 | 'id' => mt_rand(), |
|
71 | 'title' => $title, |
|
72 | 'href' => $href, |
|
73 | 'type' => static::TYPE_LINK, |
|
74 | ]; |
|
75 | ||
76 | if ($active) { |
|
77 | $this->data['active'] = count($this->data['tabs']) - 1; |
|
78 | } |
|
79 | ||
80 | return $this; |
|
81 | } |
|
82 | ||
83 | /** |
|
84 | * Set title. |