mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUG 15e2efb55d
broke the Page ListView.
This commit is contained in:
parent
c070771fd7
commit
9c4e4747c9
@ -133,13 +133,14 @@ class GridFieldDataColumns implements GridField_ColumnProvider {
|
||||
$value = $gridField->getDataFieldValue($record, $columnName);
|
||||
}
|
||||
|
||||
$value = $this->formatValue($gridField, $record, $columnName, $value);
|
||||
// Turn $value, whatever it is, into a HTML embeddable string
|
||||
$value = $this->castValue($gridField, $columnName, $value);
|
||||
// Make any formatting tweaks
|
||||
$value = $this->formatValue($gridField, $record, $columnName, $value);
|
||||
// Do any final escaping
|
||||
$value = $this->escapeValue($gridField, $value);
|
||||
|
||||
return (is_object($value) && $value instanceof Object && $value->hasMethod('forTemplate'))
|
||||
? $value->forTemplate()
|
||||
: Convert::raw2xml($value);
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -200,6 +201,7 @@ class GridFieldDataColumns implements GridField_ColumnProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts a field to a string which is safe to insert into HTML
|
||||
*
|
||||
* @param GridField $gridField
|
||||
* @param string $fieldName
|
||||
@ -207,11 +209,22 @@ class GridFieldDataColumns implements GridField_ColumnProvider {
|
||||
* @return string
|
||||
*/
|
||||
protected function castValue($gridField, $fieldName, $value) {
|
||||
// If a fieldCasting is specified, we assume the result is safe
|
||||
if(array_key_exists($fieldName, $this->fieldCasting)) {
|
||||
return $gridField->getCastedValue($value, $this->fieldCasting[$fieldName]);
|
||||
} elseif(is_object($value) && method_exists($value, 'Nice')) {
|
||||
return $value->Nice();
|
||||
$value = $gridField->getCastedValue($value, $this->fieldCasting[$fieldName]);
|
||||
}
|
||||
// If the value is an object, we do one of two things
|
||||
else if(is_object($value)) {
|
||||
// If it has a "Nice" method, call that & make sure the result is safe
|
||||
if (method_exists($value, 'Nice')) Convert::raw2xml($value->Nice());
|
||||
// Otherwise call forTemplate - the result of this should already be safe
|
||||
else $value = $value->forTemplate();
|
||||
}
|
||||
// Otherwise, just treat as a text string & make sure the result is safe
|
||||
else {
|
||||
$value = Convert::raw2xml($value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user