Path: blob/master/src/applications/auth/extension/PhabricatorAuthMainMenuBarExtension.php
12256 views
<?php12final class PhabricatorAuthMainMenuBarExtension3extends PhabricatorMainMenuBarExtension {45const MAINMENUBARKEY = 'auth';67public function isExtensionEnabledForViewer(PhabricatorUser $viewer) {8return true;9}1011public function shouldRequireFullSession() {12return false;13}1415public function getExtensionOrder() {16return 900;17}1819public function buildMainMenus() {20$viewer = $this->getViewer();2122if ($viewer->isLoggedIn()) {23return array();24}2526$controller = $this->getController();27if ($controller instanceof PhabricatorAuthController) {28// Don't show the "Login" item on auth controllers, since they're29// generally all related to logging in anyway.30return array();31}3233return array(34$this->buildLoginMenu(),35);36}3738private function buildLoginMenu() {39$controller = $this->getController();4041// See T13636. This button may be rendered by the 404 controller on sites42// other than the primary PlatformSite. Link the button to the primary43// site.4445$uri = '/auth/start/';46$uri = PhabricatorEnv::getURI($uri);47$uri = new PhutilURI($uri);48if ($controller) {49$path = $controller->getRequest()->getPath();50$uri->replaceQueryParam('next', $path);51}5253return id(new PHUIButtonView())54->setTag('a')55->setText(pht('Log In'))56->setHref($uri)57->setNoCSS(true)58->addClass('phabricator-core-login-button');59}6061}626364