Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/diviner/view/DivinerParameterTableView.php
12256 views
1
<?php
2
3
final class DivinerParameterTableView extends AphrontTagView {
4
5
private $parameters;
6
private $header;
7
8
public function setParameters(array $parameters) {
9
$this->parameters = $parameters;
10
return $this;
11
}
12
13
public function setHeader($text) {
14
$this->header = $text;
15
return $this;
16
}
17
18
protected function getTagName() {
19
return 'div';
20
}
21
22
protected function getTagAttributes() {
23
return array(
24
'class' => 'diviner-table-view',
25
);
26
}
27
28
protected function getTagContent() {
29
require_celerity_resource('diviner-shared-css');
30
31
$rows = array();
32
foreach ($this->parameters as $param) {
33
$cells = array();
34
35
$type = idx($param, 'doctype');
36
if (!$type) {
37
$type = idx($param, 'type');
38
}
39
40
$name = idx($param, 'name');
41
$docs = idx($param, 'docs');
42
43
$cells[] = phutil_tag(
44
'td',
45
array(
46
'class' => 'diviner-parameter-table-type diviner-monospace',
47
),
48
$type);
49
50
$cells[] = phutil_tag(
51
'td',
52
array(
53
'class' => 'diviner-parameter-table-name diviner-monospace',
54
),
55
$name);
56
57
$cells[] = phutil_tag(
58
'td',
59
array(
60
'class' => 'diviner-parameter-table-docs',
61
),
62
$docs);
63
64
$rows[] = phutil_tag('tr', array(), $cells);
65
}
66
67
$table = phutil_tag(
68
'table',
69
array(
70
'class' => 'diviner-parameter-table-view',
71
),
72
$rows);
73
74
$header = phutil_tag(
75
'span',
76
array(
77
'class' => 'diviner-table-header',
78
),
79
$this->header);
80
81
return array($header, $table);
82
}
83
84
}
85
86