From 226f7b230e040d372307fb9ef00dedb26764c7b8 Mon Sep 17 00:00:00 2001 From: Josh Kosmala Date: Thu, 16 Oct 2008 03:42:16 +0000 Subject: [PATCH] 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 --- forms/TreeDropdownField.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forms/TreeDropdownField.php b/forms/TreeDropdownField.php index 4ceca0924..20c5507b7 100755 --- a/forms/TreeDropdownField.php +++ b/forms/TreeDropdownField.php @@ -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'); }