3 final class PhabricatorActionListView
extends AphrontTagView
{
5 private $actions = array();
8 public function setObject(PhabricatorLiskDAO
$object) {
9 $this->object = $object;
13 public function addAction(PhabricatorActionView
$view) {
14 $this->actions
[] = $view;
18 protected function getTagName() {
19 if (!$this->actions
) {
26 protected function getTagAttributes() {
28 $classes[] = 'phabricator-action-list-view';
30 'class' => implode(' ', $classes),
34 protected function getTagContent() {
35 $viewer = $this->getViewer();
37 $event = new PhabricatorEvent(
38 PhabricatorEventType
::TYPE_UI_DIDRENDERACTIONS
,
40 'object' => $this->object,
41 'actions' => $this->actions
,
43 $event->setUser($viewer);
44 PhutilEventEngine
::dispatchEvent($event);
46 $actions = $event->getValue('actions');
51 foreach ($actions as $action) {
52 $action->setViewer($viewer);
56 foreach ($actions as $key => $action) {
57 $sort[$key] = id(new PhutilSortVector())
58 ->addInt($action->getOrder());
60 $sort = msortv($sort, 'getSelf');
61 $actions = array_select_keys($actions, array_keys($sort));
63 require_celerity_resource('phabricator-action-list-view-css');
66 foreach ($actions as $action) {
67 foreach ($action->getItems() as $item) {
75 public function getDropdownMenuMetadata() {
77 'items' => (string)hsprintf('%s', $this),