1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-15 09:11:07 +01:00
phorge-phorge/src/view/phui/PHUIBadgeBoxView.php
Chad Little bb54957d96 PHUIBadgeMiniView
Summary: Mini teeny little badges. With Timeline integration.

Test Plan:
Made some, UIExamples.

{F603564}

{F603565}

Reviewers: btrahan, epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D13620
2015-07-10 10:49:28 -07:00

57 lines
1.1 KiB
PHP

<?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;
}
}