2011-08-05 18:44:43 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @group maniphest
|
|
|
|
*/
|
|
|
|
abstract class ManiphestTaskExtensions {
|
|
|
|
|
|
|
|
final public function __construct() {
|
|
|
|
// <empty>
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract public function getAuxiliaryFieldSpecifications();
|
|
|
|
|
|
|
|
|
|
|
|
final public static function newExtensions() {
|
|
|
|
$key = 'maniphest.custom-task-extensions-class';
|
2012-03-21 22:48:58 +01:00
|
|
|
return PhabricatorEnv::newObjectFromConfig($key);
|
2011-08-05 18:44:43 +02:00
|
|
|
}
|
|
|
|
|
2013-03-08 02:22:36 +01:00
|
|
|
public function loadFields(ManiphestTask $task, PhabricatorUser $viewer) {
|
|
|
|
$aux_fields = $this->getAuxiliaryFieldSpecifications();
|
|
|
|
if (!$aux_fields) {
|
|
|
|
return array();
|
|
|
|
}
|
|
|
|
|
|
|
|
$task->loadAndAttachAuxiliaryAttributes();
|
|
|
|
foreach ($aux_fields as $aux) {
|
|
|
|
$aux->setUser($viewer);
|
|
|
|
$aux->setTask($task);
|
|
|
|
|
|
|
|
$key = $aux->getAuxiliaryKey();
|
|
|
|
$aux->setValueFromStorage($task->getAuxiliaryAttribute($key));
|
|
|
|
}
|
|
|
|
|
|
|
|
return $aux_fields;
|
|
|
|
}
|
|
|
|
|
2011-08-05 18:44:43 +02:00
|
|
|
}
|