1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-15 19:32:40 +01:00
phorge-phorge/src/view/phui/PHUIButtonBarView.php
Joshua Spence 8434143795 Fix AphrontTagView visibility
Summary: Ref T6822.

Test Plan: `grep`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T6822

Differential Revision: https://secure.phabricator.com/D11368
2015-01-14 06:54:39 +11:00

42 lines
931 B
PHP

<?php
final class PHUIButtonBarView extends AphrontTagView {
private $buttons = array();
public function addButton($button) {
$this->buttons[] = $button;
return $this;
}
protected function getTagAttributes() {
return array('class' => 'phui-button-bar');
}
protected function getTagName() {
return 'div';
}
protected function getTagContent() {
require_celerity_resource('phui-button-css');
$i = 1;
$j = count($this->buttons);
foreach ($this->buttons as $button) {
// LeeLoo Dallas Multi-Pass
if ($j > 1) {
if ($i == 1) {
$button->addClass('phui-button-bar-first');
} else if ($i == $j) {
$button->addClass('phui-button-bar-last');
} else if ($j > 1) {
$button->addClass('phui-button-bar-middle');
}
}
$this->appendChild($button);
$i++;
}
return $this->renderChildren();
}
}