Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F19491494
PhabricatorEventListener.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
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
(
pht
(
'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
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Jan 10, 7:22 AM (1 d, 2 h)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8185194
Default Alt Text
PhabricatorEventListener.php (1 KB)
Attached To
Mode
rP Phabricator
Attached
Detach File
Event Timeline
Log In to Comment