mlanthaler: Bugfix: Fixed E_NOTICE error due to uninitialized variable.

(merged from branches/gsoc)


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@41954 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2007-09-15 21:39:23 +00:00
parent 59fbe53120
commit 35c5b08b37

View File

@ -1,6 +1,7 @@
<?php
class LookupField extends DropdownField {
/**
* Returns a readonly span containing the correct value.
*/
@ -11,13 +12,24 @@ class LookupField extends DropdownField {
else $mappedValue = $this->source->getItem($this->value);
}
if(!isset($mappedValue)) $mappedValue = "<i>(none)</i>";
if(!$mappedValue)
$mappedValue = "<i>(none)</i>";
if($this->value) $val = $this->dontEscape ? ($this->reserveNL?Convert::raw2xml($this->value):$this->value) : Convert::raw2xml($this->value);
else $val = '<i>(none)</i>';
$valforInput = $this->value ? Convert::raw2att($val) : "";
if($this->value) {
$val = $this->dontEscape
? ($this->reserveNL?Convert::raw2xml($this->value):$this->value)
: Convert::raw2xml($this->value);
} else {
$val = '<i>(none)</i>';
}
return "<span class=\"readonly\" id=\"" . $this->id() . "\">$mappedValue</span><input type=\"hidden\" name=\"".$this->name."\" value=\"".$valforInput."\" />";
$valforInput = $this->value
? Convert::raw2att($val)
: "";
return "<span class=\"readonly\" id=\"" . $this->id() .
"\">$mappedValue</span><input type=\"hidden\" name=\"" . $this->name .
"\" value=\"" . $valforInput . "\" />";
}
function performReadonlyTransformation() {
return $this;