mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-24 15:52:41 +01:00
ae4e5807d6
Summary: They are same because render() returns safe HTML and raw strings are automatically escaped. Test Plan: None. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D4909
49 lines
1 KiB
PHP
49 lines
1 KiB
PHP
<?php
|
|
|
|
final class PhabricatorActionListView extends AphrontView {
|
|
|
|
private $actions = array();
|
|
private $object;
|
|
|
|
public function setObject(PhabricatorLiskDAO $object) {
|
|
$this->object = $object;
|
|
return $this;
|
|
}
|
|
|
|
public function addAction(PhabricatorActionView $view) {
|
|
$this->actions[] = $view;
|
|
return $this;
|
|
}
|
|
|
|
public function render() {
|
|
if (!$this->user) {
|
|
throw new Exception("Call setUser() before render()!");
|
|
}
|
|
|
|
$event = new PhabricatorEvent(
|
|
PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS,
|
|
array(
|
|
'object' => $this->object,
|
|
'actions' => $this->actions,
|
|
));
|
|
$event->setUser($this->user);
|
|
PhutilEventEngine::dispatchEvent($event);
|
|
|
|
$actions = $event->getValue('actions');
|
|
|
|
if (!$actions) {
|
|
return null;
|
|
}
|
|
|
|
require_celerity_resource('phabricator-action-list-view-css');
|
|
|
|
return phutil_tag(
|
|
'ul',
|
|
array(
|
|
'class' => 'phabricator-action-list-view',
|
|
),
|
|
$this->renderSingleView($actions));
|
|
}
|
|
|
|
|
|
}
|