Changeset View
Changeset View
Standalone View
Standalone View
src/applications/herald/field/HeraldField.php
Show First 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | public function getHeraldFieldConditions() { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'Herald field "%s" has unknown standard type "%s".', | 'Herald field "%s" has unknown standard type "%s".', | ||||
get_class($this), | get_class($this), | ||||
$standard_type)); | $standard_type)); | ||||
} | } | ||||
public function getHeraldFieldValueType($condition) { | public function getHeraldFieldValueType($condition) { | ||||
// NOTE: The condition type may be "null" to indicate that the caller | |||||
// wants a generic field value type. This is used when rendering field | |||||
// values in the object transcript. | |||||
$standard_type = $this->getHeraldFieldStandardType(); | $standard_type = $this->getHeraldFieldStandardType(); | ||||
switch ($standard_type) { | switch ($standard_type) { | ||||
case self::STANDARD_BOOL: | case self::STANDARD_BOOL: | ||||
case self::STANDARD_PHID_BOOL: | case self::STANDARD_PHID_BOOL: | ||||
return new HeraldEmptyFieldValue(); | return new HeraldBoolFieldValue(); | ||||
case self::STANDARD_TEXT: | case self::STANDARD_TEXT: | ||||
case self::STANDARD_TEXT_LIST: | case self::STANDARD_TEXT_LIST: | ||||
case self::STANDARD_TEXT_MAP: | case self::STANDARD_TEXT_MAP: | ||||
switch ($condition) { | switch ($condition) { | ||||
case HeraldAdapter::CONDITION_EXISTS: | case HeraldAdapter::CONDITION_EXISTS: | ||||
case HeraldAdapter::CONDITION_NOT_EXISTS: | case HeraldAdapter::CONDITION_NOT_EXISTS: | ||||
return new HeraldEmptyFieldValue(); | return new HeraldEmptyFieldValue(); | ||||
default: | default: | ||||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | public function getEditorValue( | ||||
$condition, | $condition, | ||||
$value) { | $value) { | ||||
$value_type = $this->getHeraldFieldValueType($condition); | $value_type = $this->getHeraldFieldValueType($condition); | ||||
$value_type->setViewer($viewer); | $value_type->setViewer($viewer); | ||||
return $value_type->renderEditorValue($value); | return $value_type->renderEditorValue($value); | ||||
} | } | ||||
public function renderTranscriptValue( | |||||
PhabricatorUser $viewer, | |||||
$field_value) { | |||||
$value_type = $this->getHeraldFieldValueType($condition_type = null); | |||||
$value_type->setViewer($viewer); | |||||
return $value_type->renderTranscriptValue($field_value); | |||||
} | |||||
public function getPHIDsAffectedByCondition(HeraldCondition $condition) { | public function getPHIDsAffectedByCondition(HeraldCondition $condition) { | ||||
try { | try { | ||||
$standard_type = $this->getHeraldFieldStandardType(); | $standard_type = $this->getHeraldFieldStandardType(); | ||||
} catch (PhutilMethodNotImplementedException $ex) { | } catch (PhutilMethodNotImplementedException $ex) { | ||||
$standard_type = null; | $standard_type = null; | ||||
} | } | ||||
switch ($standard_type) { | switch ($standard_type) { | ||||
▲ Show 20 Lines • Show All 107 Lines • Show Last 20 Lines |