Show '(Choose)' text on TreeDropdownField when a non-existent object is selected, as can happen when related data is removed

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.2@64355 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Josh Kosmala 2008-10-16 03:42:16 +00:00 committed by Sam Minnee
parent 26fde80558
commit 226f7b230e

View File

@ -49,7 +49,7 @@ class TreeDropdownField extends FormField {
if($this->value) {
$record = DataObject::get_by_id($this->sourceObject, $this->value);
$title = $record->Title;
$title = ($record) ? $record->Title : _t('DropdownField.CHOOSE', "(Choose)", PR_MEDIUM, 'Start-value of a dropdown');;
} else {
$title = _t('DropdownField.CHOOSE', "(Choose)", PR_MEDIUM, 'Start-value of a dropdown');
}