Changeset View
Changeset View
Standalone View
Standalone View
src/view/layout/PhabricatorActionListView.php
| <?php | <?php | ||||
| final class PhabricatorActionListView extends AphrontView { | final class PhabricatorActionListView extends AphrontTagView { | ||||
| private $actions = array(); | private $actions = array(); | ||||
| private $object; | private $object; | ||||
| private $id = null; | private $id = null; | ||||
| public function setObject(PhabricatorLiskDAO $object) { | public function setObject(PhabricatorLiskDAO $object) { | ||||
| $this->object = $object; | $this->object = $object; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function addAction(PhabricatorActionView $view) { | public function addAction(PhabricatorActionView $view) { | ||||
| $this->actions[] = $view; | $this->actions[] = $view; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function setID($id) { | public function setID($id) { | ||||
| $this->id = $id; | $this->id = $id; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getID() { | public function getID() { | ||||
| return $this->id; | return $this->id; | ||||
| } | } | ||||
| public function render() { | protected function getTagName() { | ||||
| return 'ul'; | |||||
| } | |||||
| protected function getTagAttributes() { | |||||
| $classes = array(); | |||||
| $classes[] = 'phabricator-action-list-view'; | |||||
| return array( | |||||
| 'class' => implode(' ', $classes), | |||||
| ); | |||||
| } | |||||
| protected function getTagContent() { | |||||
| $viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
| $event = new PhabricatorEvent( | $event = new PhabricatorEvent( | ||||
| PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS, | PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS, | ||||
| array( | array( | ||||
| 'object' => $this->object, | 'object' => $this->object, | ||||
| 'actions' => $this->actions, | 'actions' => $this->actions, | ||||
| )); | )); | ||||
| Show All 13 Lines | protected function getTagContent() { | ||||
| $items = array(); | $items = array(); | ||||
| foreach ($actions as $action) { | foreach ($actions as $action) { | ||||
| foreach ($action->getItems() as $item) { | foreach ($action->getItems() as $item) { | ||||
| $items[] = $item; | $items[] = $item; | ||||
| } | } | ||||
| } | } | ||||
| return phutil_tag( | return $items; | ||||
| 'ul', | |||||
| array( | |||||
| 'class' => 'phabricator-action-list-view', | |||||
| 'id' => $this->id, | |||||
| ), | |||||
| $items); | |||||
| } | } | ||||
| public function getDropdownMenuMetadata() { | public function getDropdownMenuMetadata() { | ||||
| return array( | return array( | ||||
| 'items' => (string)hsprintf('%s', $this), | 'items' => (string)hsprintf('%s', $this), | ||||
| ); | ); | ||||
| } | } | ||||
| } | } | ||||