@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
at recaptime-dev/main 50 lines 1.0 kB view raw
1<?php 2 3abstract class PhabricatorUIExample extends Phobject { 4 5 private $request; 6 7 public function setRequest($request) { 8 $this->request = $request; 9 return $this; 10 } 11 12 public function getRequest() { 13 return $this->request; 14 } 15 16 abstract public function getName(); 17 abstract public function getDescription(); 18 abstract public function renderExample(); 19 20 public function getCategory() { 21 return pht('General'); 22 } 23 24 protected function createBasicDummyHandle($name, $type, $fullname = null, 25 $uri = null) { 26 27 $id = mt_rand(15, 9999); 28 $handle = new PhabricatorObjectHandle(); 29 $handle->setName($name); 30 $handle->setType($type); 31 $handle->setPHID(PhabricatorPHID::generateNewPHID($type)); 32 33 if ($fullname) { 34 $handle->setFullName($fullname); 35 } else { 36 $handle->setFullName( 37 sprintf('%s%d: %s', 38 substr($type, 0, 1), 39 $id, 40 $name)); 41 } 42 43 if ($uri) { 44 $handle->setURI($uri); 45 } 46 47 return $handle; 48 } 49 50}