Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93062525
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
Mon, Nov 25, 22:14
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Nov 27, 22:14 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22568077
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