2014-02-10 20:11:36 +01:00
|
|
|
<?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');
|
|
|
|
}
|
|
|
|
|
2015-01-13 20:54:39 +01:00
|
|
|
protected function getTagName() {
|
2014-02-10 20:11:36 +01:00
|
|
|
return 'div';
|
|
|
|
}
|
|
|
|
|
2015-01-13 20:54:39 +01:00
|
|
|
protected function getTagContent() {
|
2014-02-10 20:11:36 +01:00
|
|
|
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');
|
2014-06-09 20:36:49 +02:00
|
|
|
} else if ($i == $j) {
|
2014-02-10 20:11:36 +01:00
|
|
|
$button->addClass('phui-button-bar-last');
|
2014-06-09 20:36:49 +02:00
|
|
|
} else if ($j > 1) {
|
2014-02-10 20:11:36 +01:00
|
|
|
$button->addClass('phui-button-bar-middle');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->appendChild($button);
|
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->renderChildren();
|
|
|
|
}
|
|
|
|
}
|