Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/view/phui/PHUIBoxView.php
12249 views
1
<?php
2
3
final class PHUIBoxView extends AphrontTagView {
4
5
private $margin = array();
6
private $padding = array();
7
private $border = false;
8
private $color;
9
10
const BLUE = 'phui-box-blue';
11
const GREY = 'phui-box-grey';
12
13
public function addMargin($margin) {
14
$this->margin[] = $margin;
15
return $this;
16
}
17
18
public function addPadding($padding) {
19
$this->padding[] = $padding;
20
return $this;
21
}
22
23
public function setBorder($border) {
24
$this->border = $border;
25
return $this;
26
}
27
28
public function setColor($color) {
29
$this->color = $color;
30
return $this;
31
}
32
33
protected function getTagAttributes() {
34
require_celerity_resource('phui-box-css');
35
$outer_classes = array();
36
$outer_classes[] = 'phui-box';
37
38
if ($this->border) {
39
$outer_classes[] = 'phui-box-border';
40
}
41
42
foreach ($this->margin as $margin) {
43
$outer_classes[] = $margin;
44
}
45
46
foreach ($this->padding as $padding) {
47
$outer_classes[] = $padding;
48
}
49
50
if ($this->color) {
51
$outer_classes[] = $this->color;
52
}
53
54
return array('class' => $outer_classes);
55
}
56
57
protected function getTagName() {
58
return 'div';
59
}
60
61
protected function getTagContent() {
62
return $this->renderChildren();
63
}
64
}
65
66