Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96122377
PhabricatorAuthMainMenuBarExtension.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Dec 22, 21:24
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Dec 24, 21:24 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23127180
Attached To
rPH Phabricator
PhabricatorAuthMainMenuBarExtension.php
View Options
<?php
final
class
PhabricatorAuthMainMenuBarExtension
extends
PhabricatorMainMenuBarExtension
{
const
MAINMENUBARKEY
=
'auth'
;
public
function
isExtensionEnabledForViewer
(
PhabricatorUser
$viewer
)
{
return
true
;
}
public
function
getExtensionOrder
()
{
return
900
;
}
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'
);
}
}
Event Timeline
Log In to Comment