[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/view/layout/ -> PhabricatorActionListView.php (source)

   1  <?php
   2  
   3  final class PhabricatorActionListView extends AphrontView {
   4  
   5    private $actions = array();
   6    private $object;
   7    private $objectURI;
   8    private $id = null;
   9  
  10    public function setObject(PhabricatorLiskDAO $object) {
  11      $this->object = $object;
  12      return $this;
  13    }
  14  
  15    public function setObjectURI($uri) {
  16      $this->objectURI = $uri;
  17      return $this;
  18    }
  19  
  20    public function addAction(PhabricatorActionView $view) {
  21      $this->actions[] = $view;
  22      return $this;
  23    }
  24  
  25    public function setID($id) {
  26      $this->id = $id;
  27      return $this;
  28    }
  29  
  30    public function render() {
  31      if (!$this->user) {
  32        throw new Exception(pht('Call setUser() before render()!'));
  33      }
  34  
  35      $event = new PhabricatorEvent(
  36        PhabricatorEventType::TYPE_UI_DIDRENDERACTIONS,
  37        array(
  38          'object'  => $this->object,
  39          'actions' => $this->actions,
  40        ));
  41      $event->setUser($this->user);
  42      PhutilEventEngine::dispatchEvent($event);
  43  
  44      $actions = $event->getValue('actions');
  45      if (!$actions) {
  46        return null;
  47      }
  48  
  49      foreach ($actions as $action) {
  50        $action->setObjectURI($this->objectURI);
  51        $action->setUser($this->user);
  52      }
  53  
  54      require_celerity_resource('phabricator-action-list-view-css');
  55  
  56      return phutil_tag(
  57        'ul',
  58        array(
  59          'class' => 'phabricator-action-list-view',
  60          'id' => $this->id,
  61        ),
  62        $actions);
  63    }
  64  
  65  
  66  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1