Something went wrong. Try again.
@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
Something went wrong. Try again.
1.9 kB · 84 lines
PHP
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485<?php
final class SubscriptionListDialogBuilder extends Phobject {
private $viewer; private $handles; private $objectPHID; private $title;
public function setViewer(PhabricatorUser $viewer) { $this->viewer = $viewer; return $this; }
public function getViewer() { return $this->viewer; }
/** * @param array<PhabricatorObjectHandle> $handles */ public function setHandles(array $handles) { assert_instances_of($handles, PhabricatorObjectHandle::class); $this->handles = $handles; return $this; }
public function getHandles() { return $this->handles; }
public function setObjectPHID($object_phid) { $this->objectPHID = $object_phid; return $this; }
public function getObjectPHID() { return $this->objectPHID; }
public function setTitle($title) { $this->title = $title; return $this; }
public function getTitle() { return $this->title; }
public function buildDialog() { $phid = $this->getObjectPHID(); $handles = $this->getHandles(); $object_handle = $handles[$phid]; unset($handles[$phid]);
return id(new AphrontDialogView()) ->setUser($this->getViewer()) ->setWidth(AphrontDialogView::WIDTH_FORM) ->setTitle($this->getTitle()) ->setObjectList($this->buildBody($this->getViewer(), $handles)) ->addCancelButton($object_handle->getURI(), pht('Close')); }
private function buildBody(PhabricatorUser $viewer, $handles) {
$list = id(new PHUIObjectItemListView()) ->setUser($viewer); foreach ($handles as $handle) { $item = id(new PHUIObjectItemView()) ->setHeader($handle->getFullName()) ->setHref($handle->getURI()) ->setDisabled($handle->isDisabled());
if ($handle->getImageURI()) { $item->setImageURI($handle->getImageURI()); }
$list->addItem($item); }
return $list; }
}