@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 122 lines 3.2 kB view raw
1<?php 2 3final class PHUIBoxExample extends PhabricatorUIExample { 4 5 public function getName() { 6 return pht('Box'); 7 } 8 9 public function getDescription() { 10 return pht("It's a fancy or non-fancy box. Put stuff in it."); 11 } 12 13 public function renderExample() { 14 15 $content1 = 'Asmund and Signy'; 16 $content2 = 'The Cottager and his Cat'; 17 $content3 = "Geirlug The King's Daughter"; 18 19 $layout1 = 20 array( 21 id(new PHUIBoxView()) 22 ->appendChild($content1), 23 id(new PHUIBoxView()) 24 ->appendChild($content2), 25 id(new PHUIBoxView()) 26 ->appendChild($content3), 27 ); 28 29 30 $layout2 = 31 array( 32 id(new PHUIBoxView()) 33 ->appendChild($content1) 34 ->addMargin(PHUI::MARGIN_SMALL_LEFT), 35 id(new PHUIBoxView()) 36 ->appendChild($content2) 37 ->addMargin(PHUI::MARGIN_MEDIUM_LEFT) 38 ->addMargin(PHUI::MARGIN_MEDIUM_TOP), 39 id(new PHUIBoxView()) 40 ->appendChild($content3) 41 ->addMargin(PHUI::MARGIN_LARGE_LEFT) 42 ->addMargin(PHUI::MARGIN_LARGE_TOP), 43 ); 44 45 $layout3 = 46 array( 47 id(new PHUIBoxView()) 48 ->appendChild($content1) 49 ->setBorder(true) 50 ->addPadding(PHUI::PADDING_SMALL) 51 ->addMargin(PHUI::MARGIN_LARGE_BOTTOM), 52 id(new PHUIBoxView()) 53 ->appendChild($content2) 54 ->setBorder(true) 55 ->addPadding(PHUI::PADDING_MEDIUM) 56 ->addMargin(PHUI::MARGIN_LARGE_BOTTOM), 57 id(new PHUIBoxView()) 58 ->appendChild($content3) 59 ->setBorder(true) 60 ->addPadding(PHUI::PADDING_LARGE) 61 ->addMargin(PHUI::MARGIN_LARGE_BOTTOM), 62 ); 63 64 $button = id(new PHUIButtonView()) 65 ->setTag('a') 66 ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE) 67 ->setIcon('fa-heart') 68 ->setText(pht('Such Wow')) 69 ->addClass(PHUI::MARGIN_SMALL_RIGHT); 70 71 $header = id(new PHUIHeaderView()) 72 ->setHeader(pht('Fancy Box')) 73 ->addActionLink($button) 74 ->setSubheader(pht('Much Features')); 75 76 $obj4 = id(new PHUIObjectBoxView()) 77 ->setHeader($header) 78 ->appendChild(id(new PHUIBoxView()) 79 ->addPadding(PHUI::PADDING_MEDIUM) 80 ->appendChild(pht('Such Fancy, Nice Box, Many Corners.'))); 81 82 $head1 = id(new PHUIHeaderView()) 83 ->setHeader(pht('Plain Box')); 84 85 $head2 = id(new PHUIHeaderView()) 86 ->setHeader(pht('Plain Box with space')); 87 88 $head3 = id(new PHUIHeaderView()) 89 ->setHeader(pht('Border Box with space')); 90 91 $head4 = id(new PHUIHeaderView()) 92 ->setHeader(pht('PHUIObjectBoxView')); 93 94 $wrap1 = id(new PHUIBoxView()) 95 ->appendChild($layout1) 96 ->addMargin(PHUI::MARGIN_LARGE); 97 98 $wrap2 = id(new PHUIBoxView()) 99 ->appendChild($layout2) 100 ->addMargin(PHUI::MARGIN_LARGE); 101 102 $wrap3 = id(new PHUIBoxView()) 103 ->appendChild($layout3) 104 ->addMargin(PHUI::MARGIN_LARGE); 105 106 return phutil_tag( 107 'div', 108 array( 109 'class' => 'ml', 110 ), 111 array( 112 $head1, 113 $wrap1, 114 $head2, 115 $wrap2, 116 $head3, 117 $wrap3, 118 $head4, 119 $obj4, 120 )); 121 } 122}