mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-14 10:52:41 +01:00
d3020af97b
Summary: This sets more reasonable values for the object handle fields imo. It's not like I ever want to find out what letter to use and then do `substr($handle->getType(), 0, 1).$handle->getID()` to get `D1` each time I use handles. Name: - D1 - T1 - M1 - P1 - etc. Fullname: - D1: Something - T1: Something - etc. In addition, this helps me to reasonable prefill Hovercards in case there is no application-specific event listener. Also deletes `title` and `alternateID` completely. They deserved that. Test Plan: Visited places, nothing broke (We only ever used `$handle->getName()` for users and commits). Tested mail reply handler. Did not test the other way around, but should be fine. Hovercards broken until D5572 (would love to induce a cyclic dependency) Reviewers: epriestley, chad, btrahan Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D5571
45 lines
912 B
PHP
45 lines
912 B
PHP
<?php
|
|
|
|
abstract class PhabricatorUIExample {
|
|
|
|
private $request;
|
|
|
|
public function setRequest($request) {
|
|
$this->request = $request;
|
|
return $this;
|
|
}
|
|
|
|
public function getRequest() {
|
|
return $this->request;
|
|
}
|
|
|
|
abstract public function getName();
|
|
abstract public function getDescription();
|
|
abstract public function renderExample();
|
|
|
|
protected function createBasicDummyHandle($name, $type, $fullname = null,
|
|
$uri = null) {
|
|
|
|
$id = mt_rand(15, 9999);
|
|
$handle = new PhabricatorObjectHandle();
|
|
$handle->setName($name);
|
|
$handle->setType($type);
|
|
$handle->setPHID(PhabricatorPHID::generateNewPHID($type));
|
|
|
|
if ($fullname) {
|
|
$handle->setFullName($fullname);
|
|
} else {
|
|
$handle->setFullName(sprintf('%s%d: %s',
|
|
substr($type, 0, 1),
|
|
$id,
|
|
$name));
|
|
}
|
|
|
|
if ($uri) {
|
|
$handle->setURI($uri);
|
|
}
|
|
|
|
return $handle;
|
|
}
|
|
|
|
}
|