Page MenuHomePhorge

PhabricatorEventListener.php
No OneTemporary

PhabricatorEventListener.php

<?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

Mime Type
text/x-php
Expires
Sun, Jan 19, 12:55 (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1124796
Default Alt Text
PhabricatorEventListener.php (1 KB)

Event Timeline