Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14416685
D12172.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D12172.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 25, 10:37 PM (12 h, 19 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6927823
Default Alt Text
D12172.diff (1 KB)
Attached To
Mode
D12172: Add ability to have tooltips on buttons
Attached
Detach File
Event Timeline
Log In to Comment