@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 AphrontMoreView extends AphrontView {
4
5 private $some;
6 private $more;
7 private $expandtext;
8
9 public function setSome($some) {
10 $this->some = $some;
11 return $this;
12 }
13
14 public function setMore($more) {
15 $this->more = $more;
16 return $this;
17 }
18
19 public function setExpandText($text) {
20 $this->expandtext = $text;
21 return $this;
22 }
23
24 public function render() {
25
26 $content = array();
27 $content[] = $this->some;
28
29 if ($this->more && $this->more != $this->some) {
30 $text = "(".pht('Show More')."\xE2\x80\xA6)";
31 if ($this->expandtext !== null) {
32 $text = $this->expandtext;
33 }
34
35 Javelin::initBehavior('aphront-more');
36 $content[] = ' ';
37 $content[] = javelin_tag(
38 'a',
39 array(
40 'sigil' => 'aphront-more-view-show-more',
41 'mustcapture' => true,
42 'href' => '#',
43 'meta' => array(
44 'more' => $this->more,
45 ),
46 ),
47 $text);
48 }
49
50 return javelin_tag(
51 'div',
52 array(
53 'sigil' => 'aphront-more-view',
54 ),
55 $content);
56 }
57}