Generate file attachment transactions for explicit Remarkup attachments on common...
[phabricator.git] / src / view / phui / PHUIButtonBarView.php
blob78443929d863c80cdcd9066074249a1f4c731641
1 <?php
3 final class PHUIButtonBarView extends AphrontTagView {
5 private $buttons = array();
6 private $borderless;
8 public function addButton($button) {
9 $this->buttons[] = $button;
10 return $this;
13 public function setBorderless($borderless) {
14 $this->borderless = $borderless;
15 return $this;
18 protected function getTagAttributes() {
19 $classes = array();
20 $classes[] = 'phui-button-bar';
21 if ($this->borderless) {
22 $classes[] = 'phui-button-bar-borderless';
24 return array('class' => implode(' ', $classes));
27 protected function getTagName() {
28 return 'span';
31 protected function getTagContent() {
32 require_celerity_resource('phui-button-bar-css');
34 $i = 1;
35 $j = count($this->buttons);
36 foreach ($this->buttons as $button) {
37 // LeeLoo Dallas Multi-Pass
38 if ($j > 1) {
39 if ($i == 1) {
40 $button->addClass('phui-button-bar-first');
41 } else if ($i == $j) {
42 $button->addClass('phui-button-bar-last');
43 } else if ($j > 1) {
44 $button->addClass('phui-button-bar-middle');
47 $this->appendChild($button);
48 $i++;
51 return $this->renderChildren();