forked from phacility/phabricator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPHUIBadgeBoxView.php
57 lines (46 loc) · 1.06 KB
/
PHUIBadgeBoxView.php
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
<?php
final class PHUIBadgeBoxView extends AphrontTagView {
private $items = array();
private $collapsed;
public function addItem($item) {
$this->items[] = $item;
return $this;
}
public function setCollapsed($collapsed) {
$this->collapsed = $collapsed;
return $this;
}
public function addItems($items) {
foreach ($items as $item) {
$this->items[] = $item;
}
return $this;
}
protected function getTagName() {
return 'ul';
}
protected function getTagAttributes() {
require_celerity_resource('phui-badge-view-css');
$classes = array();
$classes[] = 'phui-badge-flex-view';
$classes[] = 'grouped';
if ($this->collapsed) {
$classes[] = 'flex-view-collapsed';
}
return array(
'class' => implode(' ', $classes),
);
}
protected function getTagContent() {
$items = array();
foreach ($this->items as $item) {
$items[] = phutil_tag(
'li',
array(
'class' => 'phui-badge-flex-item',
),
$item);
}
return $items;
}
}