@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class PHUIBigInfoView extends AphrontTagView {
4
5 private $icon;
6 private $title;
7 private $description;
8 private $image;
9 private $actions = array();
10
11 public function setIcon($icon) {
12 $this->icon = $icon;
13 return $this;
14 }
15
16 public function setTitle($title) {
17 $this->title = $title;
18 return $this;
19 }
20
21 public function setDescription($description) {
22 $this->description = $description;
23 return $this;
24 }
25
26 public function setImage($image) {
27 $this->image = $image;
28 return $this;
29 }
30
31 public function addAction(PHUIButtonView $button) {
32 $this->actions[] = $button;
33 return $this;
34 }
35
36 protected function getTagName() {
37 return 'div';
38 }
39
40 protected function getTagAttributes() {
41 $classes = array();
42 $classes[] = 'phui-big-info-view';
43
44 return array(
45 'class' => implode(' ', $classes),
46 );
47 }
48
49 protected function getTagContent() {
50 require_celerity_resource('phui-big-info-view-css');
51
52 $icon = null;
53 if ($this->icon) {
54 $icon = id(new PHUIIconView())
55 ->setIcon($this->icon)
56 ->addClass('phui-big-info-icon');
57
58 $icon = phutil_tag(
59 'div',
60 array(
61 'class' => 'phui-big-info-icon-container',
62 ),
63 $icon);
64 }
65
66 if ($this->image) {
67 $image = phutil_tag(
68 'img',
69 array(
70 'class' => 'phui-big-info-image',
71 'src' => $this->image,
72 ));
73 $icon = phutil_tag(
74 'span',
75 array(
76 'class' => 'phui-big-info-icon-container',
77 ),
78 $image);
79 }
80
81 $title = phutil_tag(
82 'div',
83 array(
84 'class' => 'phui-big-info-title',
85 ),
86 $this->title);
87
88 $description = phutil_tag(
89 'div',
90 array(
91 'class' => 'phui-big-info-description',
92 ),
93 $this->description);
94
95 $buttons = array();
96 foreach ($this->actions as $button) {
97 $buttons[] = phutil_tag(
98 'div',
99 array(
100 'class' => 'phui-big-info-button',
101 ),
102 $button);
103 }
104
105 $actions = null;
106 if ($buttons) {
107 $actions = phutil_tag(
108 'div',
109 array(
110 'class' => 'phui-big-info-actions',
111 ),
112 $buttons);
113 }
114
115 return array($icon, $title, $description, $actions);
116
117 }
118
119}