Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/view/formation/PHUIFormationColumnItem.php
12249 views
1
<?php
2
3
final class PHUIFormationColumnItem
4
extends Phobject {
5
6
private $id;
7
private $column;
8
private $controlItem;
9
private $resizerItem;
10
private $isRightAligned;
11
private $expander;
12
private $expanders = array();
13
14
public function getID() {
15
if (!$this->id) {
16
$this->id = celerity_generate_unique_node_id();
17
}
18
return $this->id;
19
}
20
21
public function setColumn(PHUIFormationColumnView $column) {
22
$this->column = $column;
23
return $this;
24
}
25
26
public function getColumn() {
27
return $this->column;
28
}
29
30
public function setControlItem(PHUIFormationColumnItem $control_item) {
31
$this->controlItem = $control_item;
32
return $this;
33
}
34
35
public function getControlItem() {
36
return $this->controlItem;
37
}
38
39
public function setIsRightAligned($is_right_aligned) {
40
$this->isRightAligned = $is_right_aligned;
41
return $this;
42
}
43
44
public function getIsRightAligned() {
45
return $this->isRightAligned;
46
}
47
48
public function setResizerItem(PHUIFormationColumnItem $resizer_item) {
49
$this->resizerItem = $resizer_item;
50
return $this;
51
}
52
53
public function getResizerItem() {
54
return $this->resizerItem;
55
}
56
57
public function setExpander(PHUIFormationExpanderView $expander) {
58
$this->expander = $expander;
59
return $this;
60
}
61
62
public function getExpander() {
63
return $this->expander;
64
}
65
66
public function appendExpander(PHUIFormationExpanderView $expander) {
67
$this->expanders[] = $expander;
68
return $this;
69
}
70
71
public function getExpanders() {
72
return $this->expanders;
73
}
74
75
public function newClientProperties() {
76
$column = $this->getColumn();
77
78
$expander_id = null;
79
80
$expander = $this->getExpander();
81
if ($expander) {
82
$expander_id = $expander->getID();
83
}
84
85
$resizer_details = null;
86
$resizer_item = $this->getResizerItem();
87
if ($resizer_item) {
88
$visible_key = $column->getVisibleSettingKey();
89
$width_key = $column->getWidthSettingKey();
90
$min_width = $column->getMinimumWidth();
91
$max_width = $column->getMaximumWidth();
92
93
$resizer_details = array(
94
'itemID' => $resizer_item->getID(),
95
'controlID' => $resizer_item->getColumn()->getID(),
96
'widthKey' => $width_key,
97
'visibleKey' => $visible_key,
98
'minimumWidth' => $min_width,
99
'maximumWidth' => $max_width,
100
);
101
}
102
103
$width = $column->getWidth();
104
if ($width !== null) {
105
$width = (int)$width;
106
}
107
108
$is_visible = (bool)$column->getIsVisible();
109
$is_right_aligned = $this->getIsRightAligned();
110
111
$column_details = $column->newClientProperties();
112
113
return array(
114
'itemID' => $this->getID(),
115
'width' => $width,
116
'isVisible' => $is_visible,
117
'isRightAligned' => $is_right_aligned,
118
'expanderID' => $expander_id,
119
'resizer' => $resizer_details,
120
'column' => $column_details,
121
);
122
}
123
124
}
125
126