Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/home/engine/PhabricatorHomeProfileMenuEngine.php b/src/applications/home/engine/PhabricatorHomeProfileMenuEngine.php
index 888dec6a8e..d7ecd9db6f 100644
--- a/src/applications/home/engine/PhabricatorHomeProfileMenuEngine.php
+++ b/src/applications/home/engine/PhabricatorHomeProfileMenuEngine.php
@@ -1,62 +1,62 @@
<?php
final class PhabricatorHomeProfileMenuEngine
extends PhabricatorProfileMenuEngine {
protected function isMenuEngineConfigurable() {
return true;
}
public function getItemURI($path) {
return "/home/menu/{$path}";
}
protected function getBuiltinProfileItems($object) {
$viewer = $this->getViewer();
$items = array();
$custom_phid = $this->getCustomPHID();
$applications = id(new PhabricatorApplicationQuery())
->setViewer($viewer)
->withInstalled(true)
->withUnlisted(false)
->withLaunchable(true)
->execute();
// Default Home Dashboard
$items[] = $this->newItem()
->setBuiltinKey(PhabricatorHomeConstants::ITEM_HOME)
->setMenuItemKey(PhabricatorHomeProfileMenuItem::MENUITEMKEY);
$items[] = $this->newItem()
->setBuiltinKey(PhabricatorHomeConstants::ITEM_APPS_LABEL)
->setMenuItemKey(PhabricatorLabelProfileMenuItem::MENUITEMKEY)
->setMenuItemProperties(array('name' => pht('Applications')));
foreach ($applications as $application) {
if (!$application->isPinnedByDefault($viewer)) {
continue;
}
$properties = array(
- 'name' => $application->getName(),
+ 'name' => '',
'application' => $application->getPHID(),
);
$items[] = $this->newItem()
->setBuiltinKey($application->getPHID())
->setMenuItemKey(PhabricatorApplicationProfileMenuItem::MENUITEMKEY)
->setMenuItemProperties($properties);
}
// Hotlink to More Applications Launcher...
$items[] = $this->newItem()
->setBuiltinKey(PhabricatorHomeConstants::ITEM_LAUNCHER)
->setMenuItemKey(PhabricatorHomeLauncherProfileMenuItem::MENUITEMKEY);
$items[] = $this->newManageItem();
return $items;
}
}
diff --git a/src/applications/search/menuitem/PhabricatorApplicationProfileMenuItem.php b/src/applications/search/menuitem/PhabricatorApplicationProfileMenuItem.php
index 3697de3403..92477522ba 100644
--- a/src/applications/search/menuitem/PhabricatorApplicationProfileMenuItem.php
+++ b/src/applications/search/menuitem/PhabricatorApplicationProfileMenuItem.php
@@ -1,146 +1,147 @@
<?php
final class PhabricatorApplicationProfileMenuItem
extends PhabricatorProfileMenuItem {
const MENUITEMKEY = 'application';
const FIELD_APPLICATION = 'application';
public function getMenuItemTypeIcon() {
return 'fa-globe';
}
public function getMenuItemTypeName() {
return pht('Application');
}
public function canAddToObject($object) {
return true;
}
public function getDisplayName(
PhabricatorProfileMenuItemConfiguration $config) {
$application = $this->getApplication($config);
if (!$application) {
return pht('(Restricted/Invalid Application)');
}
$name = $this->getName($config);
if (strlen($name)) {
return $name;
}
return $application->getName();
}
public function buildEditEngineFields(
PhabricatorProfileMenuItemConfiguration $config) {
return array(
id(new PhabricatorDatasourceEditField())
->setKey(self::FIELD_APPLICATION)
->setLabel(pht('Application'))
->setDatasource(new PhabricatorApplicationDatasource())
->setIsRequired(true)
->setSingleValue($config->getMenuItemProperty('application')),
id(new PhabricatorTextEditField())
->setKey('name')
->setLabel(pht('Name'))
->setValue($this->getName($config)),
);
}
private function getName(
PhabricatorProfileMenuItemConfiguration $config) {
return $config->getMenuItemProperty('name');
}
private function getApplication(
PhabricatorProfileMenuItemConfiguration $config) {
$viewer = $this->getViewer();
$phid = $config->getMenuItemProperty('application');
$app = id(new PhabricatorApplicationQuery())
->setViewer($viewer)
->withPHIDs(array($phid))
->executeOne();
return $app;
}
protected function newNavigationMenuItems(
PhabricatorProfileMenuItemConfiguration $config) {
$viewer = $this->getViewer();
$app = $this->getApplication($config);
if (!$app) {
return array();
}
$is_installed = PhabricatorApplication::isClassInstalledForViewer(
get_class($app),
$viewer);
if (!$is_installed) {
return array();
}
$item = $this->newItem()
->setHref($app->getApplicationURI())
->setName($this->getDisplayName($config))
->setIcon($app->getIcon());
// Don't show tooltip if they've set a custom name
- if (strlen(($config->getMenuItemProperty('name')))) {
+ $name = $config->getMenuItemProperty('name');
+ if (!strlen($name)) {
$item->setTooltip($app->getShortDescription());
}
return array(
$item,
);
}
public function validateTransactions(
PhabricatorProfileMenuItemConfiguration $config,
$field_key,
$value,
array $xactions) {
$viewer = $this->getViewer();
$errors = array();
if ($field_key == self::FIELD_APPLICATION) {
if ($this->isEmptyTransaction($value, $xactions)) {
$errors[] = $this->newRequiredError(
pht('You must choose an application.'),
$field_key);
}
foreach ($xactions as $xaction) {
$new = $xaction['new'];
if (!$new) {
continue;
}
if ($new === $value) {
continue;
}
$applications = id(new PhabricatorApplicationQuery())
->setViewer($viewer)
->withPHIDs(array($new))
->execute();
if (!$applications) {
$errors[] = $this->newInvalidError(
pht(
'Application "%s" is not a valid application which you have '.
'permission to see.',
$new),
$xaction['xaction']);
}
}
}
return $errors;
}
}

File Metadata

Mime Type
text/x-diff
Expires
Mon, Mar 17, 12:38 AM (1 d, 19 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
72222
Default Alt Text
(6 KB)

Event Timeline