@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 PHUIButtonBarExample extends PhabricatorUIExample {
4
5 public function getName() {
6 return pht('Button Bar');
7 }
8
9 public function getDescription() {
10 return pht('A minimal UI for Buttons');
11 }
12
13 public function renderExample() {
14 $request = $this->getRequest();
15 $user = $request->getUser();
16
17 // Icon Buttons
18 $icons = array(
19 'Go Back' => 'fa-chevron-left bluegrey',
20 'Choose Date' => 'fa-calendar bluegrey',
21 'Edit View' => 'fa-pencil bluegrey',
22 'Go Forward' => 'fa-chevron-right bluegrey',
23 );
24 $button_bar1 = new PHUIButtonBarView();
25 foreach ($icons as $text => $icon) {
26 $button = id(new PHUIButtonView())
27 ->setTag('a')
28 ->setColor(PHUIButtonView::GREY)
29 ->setTitle($text)
30 ->setIcon($icon);
31
32 $button_bar1->addButton($button);
33 }
34
35 $button_bar2 = new PHUIButtonBarView();
36 foreach ($icons as $text => $icon) {
37 $button = id(new PHUIButtonView())
38 ->setTag('a')
39 ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE)
40 ->setTitle($text)
41 ->setText($text);
42
43 $button_bar2->addButton($button);
44 }
45
46 $button_bar3 = new PHUIButtonBarView();
47 foreach ($icons as $text => $icon) {
48 $button = id(new PHUIButtonView())
49 ->setTag('a')
50 ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE)
51 ->setTitle($text)
52 ->setTooltip($text)
53 ->setIcon($icon);
54
55 $button_bar3->addButton($button);
56 }
57
58 $button_bar4 = new PHUIButtonBarView();
59 $button_bar4->setBorderless(true);
60 foreach ($icons as $text => $icon) {
61 $button = id(new PHUIButtonView())
62 ->setTag('a')
63 ->setTitle($text)
64 ->setTooltip($text)
65 ->setIcon($icon);
66
67 $button_bar4->addButton($button);
68 }
69
70 $layout1 = id(new PHUIBoxView())
71 ->appendChild($button_bar1)
72 ->addClass('ml');
73
74 $layout2 = id(new PHUIBoxView())
75 ->appendChild($button_bar2)
76 ->addClass('mlr mll mlb');
77
78 $layout3 = id(new PHUIBoxView())
79 ->appendChild($button_bar3)
80 ->addClass('mlr mll mlb');
81
82 $layout4 = id(new PHUIBoxView())
83 ->appendChild($button_bar4)
84 ->addClass('mlr mll mlb');
85
86 $wrap1 = id(new PHUIObjectBoxView())
87 ->setHeaderText(pht('Button Bar Example'))
88 ->appendChild($layout1)
89 ->appendChild($layout2)
90 ->appendChild($layout3)
91 ->appendChild($layout4);
92
93 return array($wrap1);
94 }
95}