Remove product literal strings in "pht()", part 6
[phabricator.git] / src / applications / policy / view / PHUIPolicySectionView.php
blob14d97fb17e37c7d79bda808d155233820ca97a79
1 <?php
3 final class PHUIPolicySectionView
4 extends AphrontTagView {
6 private $icon;
7 private $header;
8 private $documentationLink;
10 public function setHeader($header) {
11 $this->header = $header;
12 return $this;
15 public function getHeader() {
16 return $this->header;
19 public function setIcon($icon) {
20 $this->icon = $icon;
21 return $this;
24 public function getIcon() {
25 return $this->icon;
28 public function setDocumentationLink($name, $href) {
29 $link = phutil_tag(
30 'a',
31 array(
32 'href' => $href,
33 'target' => '_blank',
35 $name);
37 $this->documentationLink = phutil_tag(
38 'div',
39 array(
40 'class' => 'phui-policy-section-view-link',
42 array(
43 id(new PHUIIconView())->setIcon('fa-book'),
44 $link,
45 ));
47 return $this;
50 public function getDocumentationLink() {
51 return $this->documentationLink;
54 public function appendList(array $items) {
55 foreach ($items as $key => $item) {
56 $items[$key] = phutil_tag(
57 'li',
58 array(
59 'class' => 'remarkup-list-item',
61 $item);
64 $list = phutil_tag(
65 'ul',
66 array(
67 'class' => 'remarkup-list',
69 $items);
71 return $this->appendChild($list);
74 public function appendHint($content) {
75 $hint = phutil_tag(
76 'p',
77 array(
78 'class' => 'phui-policy-section-view-hint',
80 array(
81 id(new PHUIIconView())
82 ->setIcon('fa-sticky-note bluegrey'),
83 ' ',
84 pht('Note:'),
85 ' ',
86 $content,
87 ));
89 return $this->appendChild($hint);
92 public function appendParagraph($content) {
93 return $this->appendChild(phutil_tag('p', array(), $content));
96 public function appendRulesView(PhabricatorPolicyRulesView $rules_view) {
97 return $this->appendChild(
98 phutil_tag(
99 'div',
100 array(
101 'class' => 'phui-policy-section-view-rules',
103 $rules_view));
106 protected function getTagAttributes() {
107 return array(
108 'class' => 'phui-policy-section-view',
112 protected function getTagContent() {
113 require_celerity_resource('phui-policy-section-view-css');
115 $icon_view = null;
116 $icon = $this->getIcon();
117 if ($icon !== null) {
118 $icon_view = id(new PHUIIconView())
119 ->setIcon($icon);
122 $header_view = phutil_tag(
123 'span',
124 array(
125 'class' => 'phui-policy-section-view-header-text',
127 $this->getHeader());
129 $header = phutil_tag(
130 'div',
131 array(
132 'class' => 'phui-policy-section-view-header',
134 array(
135 $icon_view,
136 $header_view,
137 $this->getDocumentationLink(),
140 return array(
141 $header,
142 phutil_tag(
143 'div',
144 array(
145 'class' => 'phui-policy-section-view-body',
147 $this->renderChildren()),