Differential D13589 Diff 33531 src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php
Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/customfield/standard/PhabricatorStandardCustomField.php
Show All 16 Lines | abstract class PhabricatorStandardCustomField | ||||
private $default; | private $default; | ||||
abstract public function getFieldType(); | abstract public function getFieldType(); | ||||
public static function buildStandardFields( | public static function buildStandardFields( | ||||
PhabricatorCustomField $template, | PhabricatorCustomField $template, | ||||
array $config) { | array $config) { | ||||
$types = id(new PhutilSymbolLoader()) | $types = id(new PhutilClassMapQuery()) | ||||
->setAncestorClass(__CLASS__) | ->setAncestorClass(__CLASS__) | ||||
->loadObjects(); | ->setUniqueMethod('getFieldType') | ||||
$types = mpull($types, null, 'getFieldType'); | ->execute(); | ||||
epriestley: `getFieldType()` can safely be unique'd, I think. | |||||
$fields = array(); | $fields = array(); | ||||
foreach ($config as $key => $value) { | foreach ($config as $key => $value) { | ||||
$type = idx($value, 'type', 'text'); | $type = idx($value, 'type', 'text'); | ||||
if (empty($types[$type])) { | if (empty($types[$type])) { | ||||
// TODO: We should have better typechecking somewhere, and then make | // TODO: We should have better typechecking somewhere, and then make | ||||
// this more serious. | // this more serious. | ||||
continue; | continue; | ||||
▲ Show 20 Lines • Show All 388 Lines • Show Last 20 Lines |
getFieldType() can safely be unique'd, I think.