Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/view/phui/PHUIDocumentSummaryView.php
12249 views
1
<?php
2
3
final class PHUIDocumentSummaryView extends AphrontTagView {
4
5
private $title;
6
private $image;
7
private $imageHref;
8
private $subtitle;
9
private $href;
10
private $summary;
11
private $draft;
12
13
public function setTitle($title) {
14
$this->title = $title;
15
return $this;
16
}
17
18
public function setSubtitle($subtitle) {
19
$this->subtitle = $subtitle;
20
return $this;
21
}
22
23
public function setImage($image) {
24
$this->image = $image;
25
return $this;
26
}
27
28
public function setImageHref($image_href) {
29
$this->imageHref = $image_href;
30
return $this;
31
}
32
33
public function setHref($href) {
34
$this->href = $href;
35
return $this;
36
}
37
38
public function setSummary($summary) {
39
$this->summary = $summary;
40
return $this;
41
}
42
43
public function setDraft($draft) {
44
$this->draft = $draft;
45
return $this;
46
}
47
48
protected function getTagAttributes() {
49
$classes = array();
50
$classes[] = 'phui-document-summary-view';
51
$classes[] = 'phabricator-remarkup';
52
53
if ($this->draft) {
54
$classes[] = 'is-draft';
55
}
56
57
return array(
58
'class' => implode(' ', $classes),
59
);
60
}
61
62
protected function getTagContent() {
63
require_celerity_resource('phui-document-summary-view-css');
64
65
$title = phutil_tag(
66
'a',
67
array(
68
'href' => $this->href,
69
),
70
$this->title);
71
72
$header = phutil_tag(
73
'h2',
74
array(
75
'class' => 'remarkup-header',
76
),
77
$title);
78
79
$subtitle = phutil_tag(
80
'div',
81
array(
82
'class' => 'phui-document-summary-subtitle',
83
),
84
$this->subtitle);
85
86
$body = phutil_tag(
87
'div',
88
array(
89
'class' => 'phui-document-summary-body',
90
),
91
$this->summary);
92
93
$read_more = phutil_tag(
94
'a',
95
array(
96
'class' => 'phui-document-read-more',
97
'href' => $this->href,
98
),
99
pht('Read more...'));
100
101
return array($header, $subtitle, $body, $read_more);
102
}
103
104
}
105
106