Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F94016434
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
Tue, Dec 3, 06:51
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Dec 5, 06:51 (2 d)
Engine
blob
Format
Raw Data
Handle
22710684
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
shouldRequireFullSession
()
{
return
false
;
}
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