Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100749547
PhabricatorQuickActions.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, Feb 2, 10:44
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Feb 4, 10:44 (2 d)
Engine
blob
Format
Raw Data
Handle
24027261
Attached To
rPH Phabricator
PhabricatorQuickActions.php
View Options
<?php
abstract
class
PhabricatorQuickActions
extends
Phobject
{
private
$viewer
;
public
function
setViewer
(
PhabricatorUser
$viewer
)
{
$this
->
viewer
=
$viewer
;
return
$this
;
}
public
function
getViewer
()
{
return
$this
->
viewer
;
}
public
function
isEnabled
()
{
return
true
;
}
abstract
public
function
getQuickMenuItems
();
final
public
function
getQuickActionsKey
()
{
return
$this
->
getPhobjectClassConstant
(
'QUICKACTIONSKEY'
);
}
public
static
function
getAllQuickActions
()
{
return
id
(
new
PhutilClassMapQuery
())
->
setAncestorClass
(
__CLASS__
)
->
setUniqueMethod
(
'getQuickActionsKey'
)
->
execute
();
}
public
static
function
loadMenuItemsForUser
(
PhabricatorUser
$viewer
)
{
$actions
=
self
::
getAllQuickActions
();
foreach
(
$actions
as
$key
=>
$action
)
{
$action
->
setViewer
(
$viewer
);
if
(!
$action
->
isEnabled
())
{
unset
(
$actions
[
$key
]);
continue
;
}
}
$items
=
array
();
foreach
(
$actions
as
$key
=>
$action
)
{
foreach
(
$action
->
getQuickMenuItems
()
as
$item
)
{
$items
[]
=
$item
;
}
}
return
$items
;
}
}
Event Timeline
Log In to Comment