Page MenuHomePhabricator

D12172.id29248.diff
No OneTemporary

D12172.id29248.diff

diff --git a/src/applications/uiexample/examples/PHUIButtonBarExample.php b/src/applications/uiexample/examples/PHUIButtonBarExample.php
--- a/src/applications/uiexample/examples/PHUIButtonBarExample.php
+++ b/src/applications/uiexample/examples/PHUIButtonBarExample.php
@@ -55,6 +55,7 @@
->setTag('a')
->setColor(PHUIButtonView::SIMPLE)
->setTitle($text)
+ ->setTooltip($text)
->setIcon($image);
$button_bar3->addButton($button);
diff --git a/src/view/phui/PHUIButtonView.php b/src/view/phui/PHUIButtonView.php
--- a/src/view/phui/PHUIButtonView.php
+++ b/src/view/phui/PHUIButtonView.php
@@ -22,10 +22,12 @@
private $tag = 'button';
private $dropdown;
private $icon;
+ private $iconFont;
private $href = null;
private $title = null;
private $disabled;
private $name;
+ private $tooltip;
public function setName($name) {
$this->name = $name;
@@ -81,11 +83,23 @@
return $this;
}
+ public function setTooltip($text) {
+ $this->tooltip = $text;
+ return $this;
+ }
+
public function setIcon(PHUIIconView $icon) {
$this->icon = $icon;
return $this;
}
+ public function setIconFont($icon) {
+ $icon = id(new PHUIIconView())
+ ->setIconFont($icon);
+ $this->setIcon($icon);
+ return $this;
+ }
+
protected function getTagName() {
return $this->tag;
}
@@ -117,11 +131,24 @@
$classes[] = 'disabled';
}
+ $sigil = null;
+ $meta = null;
+ if ($this->tooltip) {
+ Javelin::initBehavior('phabricator-tooltips');
+ require_celerity_resource('aphront-tooltip-css');
+ $sigil = 'has-tooltip';
+ $meta = array(
+ 'tip' => $this->tooltip,
+ );
+ }
+
return array(
'class' => $classes,
'href' => $this->href,
'name' => $this->name,
'title' => $this->title,
+ 'sigil' => $sigil,
+ 'meta' => $meta,
);
}

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 26, 11:26 AM (11 h, 35 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6927823
Default Alt Text
D12172.id29248.diff (1 KB)

Event Timeline