mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-23 15:22:41 +01:00
Allow standard fields to have defaults
Summary: Final standard capability from Maniphest fields. Test Plan: This isn't really reachable now since users always exist, but faked it and verified the field prefilled as expected. Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D7033
This commit is contained in:
parent
104c6244c3
commit
45ff6077a7
2 changed files with 7 additions and 1 deletions
|
@ -27,6 +27,7 @@ final class PhabricatorCustomFieldList extends Phobject {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read stored values for all fields which support storage.
|
* Read stored values for all fields which support storage.
|
||||||
*
|
*
|
||||||
|
@ -65,7 +66,9 @@ final class PhabricatorCustomFieldList extends Phobject {
|
||||||
$storage = idx($objects, $key);
|
$storage = idx($objects, $key);
|
||||||
if ($storage) {
|
if ($storage) {
|
||||||
$field->setValueFromStorage($storage->getFieldValue());
|
$field->setValueFromStorage($storage->getFieldValue());
|
||||||
} else {
|
} else if ($object->getPHID()) {
|
||||||
|
// NOTE: We set this only if the object exists. Otherwise, we allow the
|
||||||
|
// field to retain any default value it may have.
|
||||||
$field->setValueFromStorage(null);
|
$field->setValueFromStorage(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,6 +108,9 @@ abstract class PhabricatorStandardCustomField
|
||||||
$this->setRequired($value);
|
$this->setRequired($value);
|
||||||
$this->setFieldError(true);
|
$this->setFieldError(true);
|
||||||
break;
|
break;
|
||||||
|
case 'default':
|
||||||
|
$this->setFieldValue($value);
|
||||||
|
break;
|
||||||
case 'type':
|
case 'type':
|
||||||
// We set this earlier on.
|
// We set this earlier on.
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue