Page MenuHomePhabricator

D18114.id43584.diff
No OneTemporary

D18114.id43584.diff

diff --git a/src/applications/uiexample/examples/PHUIIconExample.php b/src/applications/uiexample/examples/PHUIIconExample.php
--- a/src/applications/uiexample/examples/PHUIIconExample.php
+++ b/src/applications/uiexample/examples/PHUIIconExample.php
@@ -159,7 +159,8 @@
->setIcon($icon)
->setBackground('bg-blue')
->setHref('#')
- ->addClass('mmr');
+ ->addClass('mmr')
+ ->setTooltip($icon);
}
$layout_cicons = id(new PHUIBoxView())
diff --git a/src/view/phui/PHUIIconView.php b/src/view/phui/PHUIIconView.php
--- a/src/view/phui/PHUIIconView.php
+++ b/src/view/phui/PHUIIconView.php
@@ -18,6 +18,7 @@
private $iconFont;
private $iconColor;
private $iconBackground;
+ private $tooltip;
public function setHref($href) {
$this->href = $href;
@@ -60,6 +61,11 @@
return $this;
}
+ public function setTooltip($text) {
+ $this->tooltip = $text;
+ return $this;
+ }
+
protected function getTagName() {
$tag = 'span';
if ($this->href) {
@@ -100,11 +106,24 @@
$this->appendChild($this->text);
}
+ $sigil = null;
+ $meta = array();
+ if ($this->tooltip) {
+ Javelin::initBehavior('phabricator-tooltips');
+ require_celerity_resource('aphront-tooltip-css');
+ $sigil = 'has-tooltip';
+ $meta = array(
+ 'tip' => $this->tooltip,
+ );
+ }
+
return array(
'href' => $this->href,
'style' => $style,
'aural' => false,
'class' => $classes,
+ 'sigil' => $sigil,
+ 'meta' => $meta,
);
}

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 23, 2:14 AM (56 m, 18 s)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7029694
Default Alt Text
D18114.id43584.diff (1 KB)

Event Timeline