#1685 - Undefined index message when on readonly page in CMS (after deleting a page)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@44585 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Andrew O'Neil 2007-11-11 21:10:59 +00:00
parent c36eac4671
commit 6d065d58f3

View File

@ -8,12 +8,16 @@ class LookupField extends DropdownField {
function Field() {
if(trim($this->value)) {
$this->value = trim($this->value);
if(is_array($this->source)) $mappedValue = $this->source[$this->value];
else $mappedValue = $this->source->getItem($this->value);
if(is_array($this->source)) {
$mappedValue = isset($this->source[$this->value]) ? $this->source[$this->value] : null;
} else {
$mappedValue = $this->source->getItem($this->value);
}
}
if(!isset($mappedValue))
if(!isset($mappedValue)) {
$mappedValue = "<i>(none)</i>";
}
if($this->value) {
$val = $this->dontEscape
@ -39,4 +43,4 @@ class LookupField extends DropdownField {
}
}
?>
?>