Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F71265457
PhabricatorEventListener.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
Wed, Jul 10, 16:32
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Jul 12, 16:32 (2 d)
Engine
blob
Format
Raw Data
Handle
18924971
Attached To
rPH Phabricator
PhabricatorEventListener.php
View Options
<?php
abstract
class
PhabricatorEventListener
extends
PhutilEventListener
{
private
$application
;
public
function
setApplication
(
PhabricatorApplication
$application
)
{
$this
->
application
=
$application
;
return
$this
;
}
public
function
getApplication
()
{
return
$this
->
application
;
}
public
function
hasApplicationCapability
(
PhabricatorUser
$viewer
,
$capability
)
{
return
PhabricatorPolicyFilter
::
hasCapability
(
$viewer
,
$this
->
getApplication
(),
$capability
);
}
public
function
canUseApplication
(
PhabricatorUser
$viewer
)
{
return
$this
->
hasApplicationCapability
(
$viewer
,
PhabricatorPolicyCapability
::
CAN_VIEW
);
}
protected
function
addActionMenuItems
(
PhutilEvent
$event
,
$items
)
{
if
(
$event
->
getType
()
!==
PhabricatorEventType
::
TYPE_UI_DIDRENDERACTIONS
)
{
throw
new
Exception
(
'Not an action menu event!'
);
}
if
(!
$items
)
{
return
;
}
if
(!
is_array
(
$items
))
{
$items
=
array
(
$items
);
}
$event_actions
=
$event
->
getValue
(
'actions'
);
foreach
(
$items
as
$item
)
{
$event_actions
[]
=
$item
;
}
$event
->
setValue
(
'actions'
,
$event_actions
);
}
}
Event Timeline
Log In to Comment