3 final class PhabricatorFileLinkView
extends AphrontTagView
{
6 private $fileDownloadURI;
10 private $fileMonogram;
14 public function setCustomClass($custom_class) {
15 $this->customClass
= $custom_class;
19 public function getCustomClass() {
20 return $this->customClass
;
23 public function setFilePHID($file_phid) {
24 $this->filePHID
= $file_phid;
28 private function getFilePHID() {
29 return $this->filePHID
;
32 public function setFileMonogram($monogram) {
33 $this->fileMonogram
= $monogram;
37 private function getFileMonogram() {
38 return $this->fileMonogram
;
41 public function setFileViewable($file_viewable) {
42 $this->fileViewable
= $file_viewable;
46 private function getFileViewable() {
47 return $this->fileViewable
;
50 public function setFileViewURI($file_view_uri) {
51 $this->fileViewURI
= $file_view_uri;
55 private function getFileViewURI() {
56 return $this->fileViewURI
;
59 public function setFileDownloadURI($file_download_uri) {
60 $this->fileDownloadURI
= $file_download_uri;
64 private function getFileDownloadURI() {
65 return $this->fileDownloadURI
;
68 public function setFileName($file_name) {
69 $this->fileName
= $file_name;
73 private function getFileName() {
74 return $this->fileName
;
77 public function setFileSize($file_size) {
78 $this->fileSize
= $file_size;
82 private function getFileSize() {
83 return $this->fileSize
;
86 private function getFileIcon() {
87 return FileTypeIcon
::getFileIcon($this->getFileName());
90 public function getMeta() {
92 'phid' => $this->getFilePHID(),
93 'viewable' => $this->getFileViewable(),
94 'uri' => $this->getFileViewURI(),
95 'dUri' => $this->getFileDownloadURI(),
96 'name' => $this->getFileName(),
97 'monogram' => $this->getFileMonogram(),
98 'icon' => $this->getFileIcon(),
99 'size' => $this->getFileSize(),
103 protected function getTagName() {
104 if ($this->getFileDownloadURI()) {
111 protected function getTagAttributes() {
112 $class = 'phabricator-remarkup-embed-layout-link';
113 if ($this->getCustomClass()) {
114 $class = $this->getCustomClass();
118 'href' => $this->getFileViewURI(),
119 'target' => '_blank',
120 'rel' => 'noreferrer',
124 if ($this->getFilePHID()) {
126 $sigil = 'lightboxable';
127 $meta = $this->getMeta();
129 $attributes +
= array(
132 'mustcapture' => $mustcapture,
139 protected function getTagContent() {
140 require_celerity_resource('phabricator-remarkup-css');
141 require_celerity_resource('phui-lightbox-css');
143 $icon = id(new PHUIIconView())
144 ->setIcon($this->getFileIcon())
145 ->addClass('phabricator-remarkup-embed-layout-icon');
147 $download_link = null;
149 $download_uri = $this->getFileDownloadURI();
151 $dl_icon = id(new PHUIIconView())
152 ->setIcon('fa-download');
154 $download_link = phutil_tag(
157 'class' => 'phabricator-remarkup-embed-layout-download',
158 'href' => $download_uri,
166 'class' => 'phabricator-remarkup-embed-layout-info',
168 $this->getFileSize());
173 'class' => 'phabricator-remarkup-embed-layout-name',
175 $this->getFileName());
180 'class' => 'phabricator-remarkup-embed-layout-info-block',