getSource(); // Normalize value to array to simplify further processing if(is_array($this->value) || is_object($this->value)) { $values = $this->value; } else { $values = array(trim($this->value)); } $mapped = array(); if($source instanceof SQLMap) { foreach($values as $value) { $mapped[] = $source->getItem($value); } } else if($source instanceof ArrayAccess || is_array($source)) { $source = ArrayLib::flatten($source); foreach($values as $value) { if(isset($source[$value])) { $mapped[] = $source[$value]; } } } else { $mapped = array(); } // Don't check if string arguments are matching against the source, // as they might be generated HTML diff views instead of the actual values if($this->value && !is_array($this->value) && !$mapped) { $mapped = array(trim($this->value)); $values = array(); } if($mapped) { $attrValue = implode(', ', array_values($mapped)); if(!$this->dontEscape) { $attrValue = Convert::raw2xml($attrValue); } $inputValue = implode(', ', array_values($values)); } else { $attrValue = "(none)"; $inputValue = ''; } return "id() . "\">$attrValuename . "\" value=\"" . $inputValue . "\" />"; } /** * @return LookupField */ public function performReadonlyTransformation() { $clone = clone $this; return $clone; } /** * @return string */ public function Type() { return "lookup readonly"; } /** * Override parent behavior by not merging arrays. * * @return array */ public function getSource() { return $this->source; } }