@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
at upstream/main 118 lines 2.1 kB view raw
1<?php 2 3final class PHUICMSView extends AphrontTagView { 4 5 private $header; 6 private $nav; 7 private $crumbs; 8 private $content; 9 private $toc; 10 private $comments; 11 12 public function setHeader(PHUIHeaderView $header) { 13 $this->header = $header; 14 return $this; 15 } 16 17 public function setNavigation(AphrontSideNavFilterView $nav) { 18 $this->nav = $nav; 19 return $this; 20 } 21 22 public function setCrumbs(PHUICrumbsView $crumbs) { 23 $this->crumbs = $crumbs; 24 return $this; 25 } 26 27 public function setContent($content) { 28 $this->content = $content; 29 return $this; 30 } 31 32 public function setToc($toc) { 33 $this->toc = $toc; 34 return $this; 35 } 36 37 public function setComments($comments) { 38 $this->comments = $comments; 39 } 40 41 protected function getTagName() { 42 return 'div'; 43 } 44 45 protected function getTagAttributes() { 46 require_celerity_resource('phui-cms-css'); 47 48 $classes = array(); 49 $classes[] = 'phui-cms-view'; 50 51 if ($this->comments) { 52 $classes[] = 'phui-cms-has-comments'; 53 } 54 55 return array( 56 'class' => implode(' ', $classes), 57 ); 58 59 } 60 61 protected function getTagContent() { 62 63 $content = phutil_tag( 64 'div', 65 array( 66 'class' => 'phui-cms-page-content', 67 ), 68 array( 69 $this->header, 70 $this->content, 71 )); 72 73 $comments = null; 74 if ($this->comments) { 75 $comments = phutil_tag( 76 'div', 77 array( 78 'class' => 'phui-cms-comments', 79 ), 80 array( 81 $this->comments, 82 )); 83 } 84 85 $navigation = $this->nav; 86 $navigation->appendChild($content); 87 $navigation->appendChild($comments); 88 89 $page = phutil_tag( 90 'div', 91 array( 92 'class' => 'phui-cms-inner', 93 ), 94 array( 95 $navigation, 96 )); 97 98 $cms_view = phutil_tag( 99 'div', 100 array( 101 'class' => 'phui-cms-wrap', 102 ), 103 array( 104 $this->crumbs, 105 $page, 106 )); 107 108 $classes = array(); 109 $classes[] = 'phui-cms-page'; 110 111 return phutil_tag( 112 'div', 113 array( 114 'class' => implode(' ', $classes), 115 ), 116 $cms_view); 117 } 118}