Differential D20358 Diff 48609 src/applications/search/menuitem/PhabricatorApplicationProfileMenuItem.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/search/menuitem/PhabricatorApplicationProfileMenuItem.php
Show First 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | private function getApplication( | ||||
$apps = id(new PhabricatorApplicationQuery()) | $apps = id(new PhabricatorApplicationQuery()) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->withPHIDs(array($phid)) | ->withPHIDs(array($phid)) | ||||
->execute(); | ->execute(); | ||||
return head($apps); | return head($apps); | ||||
} | } | ||||
protected function newNavigationMenuItems( | protected function newMenuItemViewList( | ||||
PhabricatorProfileMenuItemConfiguration $config) { | PhabricatorProfileMenuItemConfiguration $config) { | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
$app = $this->getApplication($config); | $app = $this->getApplication($config); | ||||
if (!$app) { | if (!$app) { | ||||
return array(); | return array(); | ||||
} | } | ||||
$is_installed = PhabricatorApplication::isClassInstalledForViewer( | $is_installed = PhabricatorApplication::isClassInstalledForViewer( | ||||
get_class($app), | get_class($app), | ||||
$viewer); | $viewer); | ||||
if (!$is_installed) { | if (!$is_installed) { | ||||
return array(); | return array(); | ||||
} | } | ||||
$item = $this->newItem() | $item = $this->newItemView() | ||||
->setHref($app->getApplicationURI()) | ->setURI($app->getApplicationURI()) | ||||
->setName($this->getDisplayName($config)) | ->setName($this->getDisplayName($config)) | ||||
->setIcon($app->getIcon()); | ->setIcon($app->getIcon()); | ||||
// Don't show tooltip if they've set a custom name | // Don't show tooltip if they've set a custom name | ||||
$name = $config->getMenuItemProperty('name'); | $name = $config->getMenuItemProperty('name'); | ||||
if (!strlen($name)) { | if (!strlen($name)) { | ||||
$item->setTooltip($app->getShortDescription()); | $item->setTooltip($app->getShortDescription()); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 52 Lines • Show Last 20 Lines |