Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phid/type/PhabricatorPHIDType.php
Show All 14 Lines | if (!is_string($const) || !preg_match('/^[A-Z]{4}$/', $const)) { | ||||
'TYPECONST')); | 'TYPECONST')); | ||||
} | } | ||||
return $const; | return $const; | ||||
} | } | ||||
abstract public function getTypeName(); | abstract public function getTypeName(); | ||||
public function newObject() { | |||||
return null; | |||||
} | |||||
public function getTypeIcon() { | public function getTypeIcon() { | ||||
// Default to the application icon if the type doesn't specify one. | // Default to the application icon if the type doesn't specify one. | ||||
$application_class = $this->getPHIDTypeApplicationClass(); | $application_class = $this->getPHIDTypeApplicationClass(); | ||||
if ($application_class) { | if ($application_class) { | ||||
$application = newv($application_class, array()); | $application = newv($application_class, array()); | ||||
return $application->getFontIcon(); | return $application->getFontIcon(); | ||||
} | } | ||||
return null; | return null; | ||||
} | } | ||||
public function newObject() { | |||||
return null; | |||||
} | |||||
/** | /** | ||||
* Get the class name for the application this type belongs to. | * Get the class name for the application this type belongs to. | ||||
* | * | ||||
* @return string|null Class name of the corresponding application, or null | * @return string|null Class name of the corresponding application, or null | ||||
* if the type is not bound to an application. | * if the type is not bound to an application. | ||||
*/ | */ | ||||
public function getPHIDTypeApplicationClass() { | abstract public function getPHIDTypeApplicationClass(); | ||||
// TODO: Some day this should probably be abstract, but for now it only | |||||
// affects global search and there's no real burning need to go classify | |||||
// every PHID type. | |||||
return null; | |||||
} | |||||
/** | /** | ||||
* Build a @{class:PhabricatorPolicyAwareQuery} to load objects of this type | * Build a @{class:PhabricatorPolicyAwareQuery} to load objects of this type | ||||
* by PHID. | * by PHID. | ||||
* | * | ||||
* If you can not build a single query which satisfies this requirement, you | * If you can not build a single query which satisfies this requirement, you | ||||
* can provide a dummy implementation for this method and overload | * can provide a dummy implementation for this method and overload | ||||
* @{method:loadObjects} instead. | * @{method:loadObjects} instead. | ||||
▲ Show 20 Lines • Show All 144 Lines • Show Last 20 Lines |