@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 PhameDescriptionView extends AphrontTagView {
4
5 private $title;
6 private $description;
7 private $image;
8 private $imageHref;
9
10 public function setTitle($title) {
11 $this->title = $title;
12 return $this;
13 }
14
15 public function setDescription($description) {
16 $this->description = $description;
17 return $this;
18 }
19
20 public function setImage($image) {
21 $this->image = $image;
22 return $this;
23 }
24
25 public function setImageHref($href) {
26 $this->imageHref = $href;
27 return $this;
28 }
29
30 protected function getTagAttributes() {
31 $classes = array();
32 $classes[] = 'phame-blog-description';
33 return array('class' => implode(' ', $classes));
34 }
35
36 protected function getTagContent() {
37 require_celerity_resource('phame-css');
38
39 $description = phutil_tag_div(
40 'phame-blog-description-content', $this->description);
41
42 $image = phutil_tag(
43 ($this->imageHref) ? 'a' : 'div',
44 array(
45 'class' => 'phame-blog-description-image',
46 'style' => 'background-image: url('.$this->image.');',
47 'href' => $this->imageHref,
48 ));
49
50 $header = phutil_tag(
51 'div',
52 array(
53 'class' => 'phame-blog-description-name',
54 ),
55 $this->title);
56
57 return array($image, $header, $description);
58 }
59
60}