3 final class PhabricatorAuthMainMenuBarExtension
4 extends PhabricatorMainMenuBarExtension
{
6 const MAINMENUBARKEY
= 'auth';
8 public function isExtensionEnabledForViewer(PhabricatorUser
$viewer) {
12 public function shouldRequireFullSession() {
16 public function getExtensionOrder() {
20 public function buildMainMenus() {
21 $viewer = $this->getViewer();
23 if ($viewer->isLoggedIn()) {
27 $controller = $this->getController();
28 if ($controller instanceof PhabricatorAuthController
) {
29 // Don't show the "Login" item on auth controllers, since they're
30 // generally all related to logging in anyway.
35 $this->buildLoginMenu(),
39 private function buildLoginMenu() {
40 $controller = $this->getController();
42 // See T13636. This button may be rendered by the 404 controller on sites
43 // other than the primary PlatformSite. Link the button to the primary
46 $uri = '/auth/start/';
47 $uri = PhabricatorEnv
::getURI($uri);
48 $uri = new PhutilURI($uri);
50 $path = $controller->getRequest()->getPath();
51 $uri->replaceQueryParam('next', $path);
54 return id(new PHUIButtonView())
56 ->setText(pht('Log In'))
59 ->addClass('phabricator-core-login-button');