Generate file attachment transactions for explicit Remarkup attachments on common...
[phabricator.git] / src / view / phui / PHUIBoxView.php
blob7068f8811cc72bff6dc5c0ff962dc455022c96e5
1 <?php
3 final class PHUIBoxView extends AphrontTagView {
5 private $margin = array();
6 private $padding = array();
7 private $border = false;
8 private $color;
10 const BLUE = 'phui-box-blue';
11 const GREY = 'phui-box-grey';
13 public function addMargin($margin) {
14 $this->margin[] = $margin;
15 return $this;
18 public function addPadding($padding) {
19 $this->padding[] = $padding;
20 return $this;
23 public function setBorder($border) {
24 $this->border = $border;
25 return $this;
28 public function setColor($color) {
29 $this->color = $color;
30 return $this;
33 protected function getTagAttributes() {
34 require_celerity_resource('phui-box-css');
35 $outer_classes = array();
36 $outer_classes[] = 'phui-box';
38 if ($this->border) {
39 $outer_classes[] = 'phui-box-border';
42 foreach ($this->margin as $margin) {
43 $outer_classes[] = $margin;
46 foreach ($this->padding as $padding) {
47 $outer_classes[] = $padding;
50 if ($this->color) {
51 $outer_classes[] = $this->color;
54 return array('class' => $outer_classes);
57 protected function getTagName() {
58 return 'div';
61 protected function getTagContent() {
62 return $this->renderChildren();