Skip to content

Commit 3f1ee67

Browse files
author
Chad Little
committedMar 1, 2017
Add a tooltip option to Link menu items
Summary: Ref T12174. Let's users add a tooltip to LinkProfileMenuItem Test Plan: Add a tooltip, remove tooltip. Menu appears as expected Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T12174 Differential Revision: https://secure.phabricator.com/D17437
1 parent bf0a7cb commit 3f1ee67

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed
 

‎src/applications/search/menuitem/PhabricatorLinkProfileMenuItem.php

+13-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ final class PhabricatorLinkProfileMenuItem
77

88
const FIELD_URI = 'uri';
99
const FIELD_NAME = 'name';
10+
const FIELD_TOOLTIP = 'tooltip';
1011

1112
public function getMenuItemTypeIcon() {
1213
return 'fa-link';
@@ -38,6 +39,10 @@ public function buildEditEngineFields(
3839
->setLabel(pht('URI'))
3940
->setIsRequired(true)
4041
->setValue($this->getLinkURI($config)),
42+
id(new PhabricatorTextEditField())
43+
->setKey(self::FIELD_TOOLTIP)
44+
->setLabel(pht('Tooltip'))
45+
->setValue($this->getLinkTooltip($config)),
4146
id(new PhabricatorIconSetEditField())
4247
->setKey('icon')
4348
->setLabel(pht('Icon'))
@@ -61,6 +66,11 @@ private function getLinkURI(
6166
return $config->getMenuItemProperty('uri');
6267
}
6368

69+
private function getLinkTooltip(
70+
PhabricatorProfileMenuItemConfiguration $config) {
71+
return $config->getMenuItemProperty('tooltip');
72+
}
73+
6474
private function isValidLinkURI($uri) {
6575
return PhabricatorEnv::isValidURIForLink($uri);
6676
}
@@ -71,6 +81,7 @@ protected function newNavigationMenuItems(
7181
$icon = $this->getLinkIcon($config);
7282
$name = $this->getLinkName($config);
7383
$href = $this->getLinkURI($config);
84+
$tooltip = $this->getLinkTooltip($config);
7485

7586
if (!$this->isValidLinkURI($href)) {
7687
$href = '#';
@@ -87,7 +98,8 @@ protected function newNavigationMenuItems(
8798
$item = $this->newItem()
8899
->setHref($href)
89100
->setName($name)
90-
->setIcon($icon_class);
101+
->setIcon($icon_class)
102+
->setTooltip($tooltip);
91103

92104
return array(
93105
$item,

0 commit comments

Comments
 (0)
Failed to load comments.