Merge pull request #680 from jakr/datacolumns

Reformatted code and added missing assignment
This commit is contained in:
Hamish Friedlander 2012-07-29 15:15:34 -07:00
commit 20a2c47023

View File

@ -212,16 +212,17 @@ class GridFieldDataColumns implements GridField_ColumnProvider {
// If a fieldCasting is specified, we assume the result is safe // If a fieldCasting is specified, we assume the result is safe
if(array_key_exists($fieldName, $this->fieldCasting)) { if(array_key_exists($fieldName, $this->fieldCasting)) {
$value = $gridField->getCastedValue($value, $this->fieldCasting[$fieldName]); $value = $gridField->getCastedValue($value, $this->fieldCasting[$fieldName]);
} } else if(is_object($value)) {
// If the value is an object, we do one of two things // If the value is an object, we do one of two things
else if(is_object($value)) { if (method_exists($value, 'Nice')) {
// If it has a "Nice" method, call that & make sure the result is safe // If it has a "Nice" method, call that & make sure the result is safe
if (method_exists($value, 'Nice')) Convert::raw2xml($value->Nice()); $value = Convert::raw2xml($value->Nice());
// Otherwise call forTemplate - the result of this should already be safe } else {
else $value = $value->forTemplate(); // Otherwise call forTemplate - the result of this should already be safe
} $value = $value->forTemplate();
// Otherwise, just treat as a text string & make sure the result is safe }
else { } else {
// Otherwise, just treat as a text string & make sure the result is safe
$value = Convert::raw2xml($value); $value = Convert::raw2xml($value);
} }