Differential D17247 Diff 41483 src/applications/home/controller/PhabricatorHomeMenuItemController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/home/controller/PhabricatorHomeMenuItemController.php
<?php | <?php | ||||
final class PhabricatorHomeMenuItemController | final class PhabricatorHomeMenuItemController | ||||
extends PhabricatorHomeController { | extends PhabricatorHomeController { | ||||
public function handleRequest(AphrontRequest $request) { | public function handleRequest(AphrontRequest $request) { | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
$type = $request->getURIData('type'); | $type = $request->getURIData('type'); | ||||
$custom_phid = null; | $custom_phid = null; | ||||
$menu = PhabricatorProfileMenuEngine::MENU_GLOBAL; | |||||
if ($type == 'personal') { | if ($type == 'personal') { | ||||
$custom_phid = $viewer->getPHID(); | $custom_phid = $viewer->getPHID(); | ||||
$menu = PhabricatorProfileMenuEngine::MENU_PERSONAL; | |||||
} | } | ||||
$application = 'PhabricatorHomeApplication'; | $application = 'PhabricatorHomeApplication'; | ||||
$home_app = id(new PhabricatorApplicationQuery()) | $home_app = id(new PhabricatorApplicationQuery()) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->withClasses(array($application)) | ->withClasses(array($application)) | ||||
->withInstalled(true) | ->withInstalled(true) | ||||
->executeOne(); | ->executeOne(); | ||||
$engine = id(new PhabricatorHomeProfileMenuEngine()) | $engine = id(new PhabricatorHomeProfileMenuEngine()) | ||||
->setProfileObject($home_app) | ->setProfileObject($home_app) | ||||
->setCustomPHID($custom_phid) | ->setCustomPHID($custom_phid) | ||||
->setController($this); | ->setMenuType($menu) | ||||
->setController($this) | |||||
->setShowNavigation(false); | |||||
return $engine->buildResponse(); | return $engine->buildResponse(); | ||||
} | } | ||||
} | } |