Differential D13500 Diff 32783 src/applications/maniphest/herald/ManiphestTaskPriorityHeraldField.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/maniphest/herald/ManiphestTaskPriorityHeraldField.php
- This file was added.
<?php | |||||
final class ManiphestTaskPriorityHeraldField | |||||
extends ManiphestHeraldField { | |||||
const FIELDCONST = 'taskpriority'; | |||||
public function getHeraldFieldName() { | |||||
return pht('Task priority'); | |||||
} | |||||
public function getHeraldFieldValue($object) { | |||||
return $object->getPriority(); | |||||
} | |||||
protected function getHeraldFieldStandardConditions() { | |||||
return self::STANDARD_PHID; | |||||
} | |||||
public function getHeraldFieldValueType($condition) { | |||||
return HeraldAdapter::VALUE_TASK_PRIORITY; | |||||
} | |||||
public function renderConditionValue( | |||||
PhabricatorUser $viewer, | |||||
$value) { | |||||
$priority_map = ManiphestTaskPriority::getTaskPriorityMap(); | |||||
$value = (array)$value; | |||||
foreach ($value as $index => $val) { | |||||
$name = idx($priority_map, $val); | |||||
if ($name !== null) { | |||||
$value[$index] = $name; | |||||
} | |||||
} | |||||
return implode(', ', $value); | |||||
} | |||||
public function getEditorValue( | |||||
PhabricatorUser $viewer, | |||||
$value) { | |||||
$priority_map = ManiphestTaskPriority::getTaskPriorityMap(); | |||||
$value_map = array(); | |||||
foreach ($value as $priority) { | |||||
$value_map[$priority] = idx($priority_map, $priority, $priority); | |||||
} | |||||
return $value_map; | |||||
} | |||||
} |