Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F452554
PhabricatorAuthMainMenuBarExtension.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorAuthMainMenuBarExtension.php
View Options
<?php
final
class
PhabricatorAuthMainMenuBarExtension
extends
PhabricatorMainMenuBarExtension
{
const
MAINMENUBARKEY
=
'auth'
;
public
function
isExtensionEnabledForViewer
(
PhabricatorUser
$viewer
)
{
return
true
;
}
public
function
buildMainMenus
()
{
$viewer
=
$this
->
getViewer
();
if
(
$viewer
->
isLoggedIn
())
{
return
array
();
}
$controller
=
$this
->
getController
();
if
(
$controller
instanceof
PhabricatorAuthController
)
{
// Don't show the "Login" item on auth controllers, since they're
// generally all related to logging in anyway.
return
array
();
}
return
array
(
$this
->
buildLoginMenu
(),
);
}
private
function
buildLoginMenu
()
{
$controller
=
$this
->
getController
();
$uri
=
new
PhutilURI
(
'/auth/start/'
);
if
(
$controller
)
{
$path
=
$controller
->
getRequest
()->
getPath
();
$uri
->
setQueryParam
(
'next'
,
$path
);
}
return
id
(
new
PHUIButtonView
())
->
setTag
(
'a'
)
->
setText
(
pht
(
'Log In'
))
->
setHref
(
$uri
)
->
setNoCSS
(
true
)
->
addClass
(
'phabricator-core-login-button'
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 5, 12:45 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
59801
Default Alt Text
PhabricatorAuthMainMenuBarExtension.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment