mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX Fixed GridField->setFieldFormatting()
This commit is contained in:
parent
8a8f741584
commit
d4bde47944
@ -31,23 +31,24 @@ class GridFieldDefaultColumns implements GridField_ColumnProvider {
|
||||
|
||||
// This supports simple FieldName syntax
|
||||
if(strpos($fieldName, '.') === false) {
|
||||
return ($item->XML_val($fieldName) && $xmlSafe) ? $item->XML_val($fieldName) : $item->RAW_val($fieldName);
|
||||
}
|
||||
$fieldNameParts = explode('.', $fieldName);
|
||||
$tmpItem = $item;
|
||||
for($idx = 0; $idx < sizeof($fieldNameParts); $idx++) {
|
||||
$relationMethod = $fieldNameParts[$idx];
|
||||
// Last value for value
|
||||
if($idx == sizeof($fieldNameParts) - 1) {
|
||||
if($tmpItem) {
|
||||
return ($tmpItem->XML_val($relationMethod) && $xmlSafe) ? $tmpItem->XML_val($relationMethod) : $tmpItem->RAW_val($relationMethod);
|
||||
$value = ($item->XML_val($fieldName) && $xmlSafe) ? $item->XML_val($fieldName) : $item->RAW_val($fieldName);
|
||||
} else {
|
||||
$fieldNameParts = explode('.', $fieldName);
|
||||
$tmpItem = $item;
|
||||
for($idx = 0; $idx < sizeof($fieldNameParts); $idx++) {
|
||||
$relationMethod = $fieldNameParts[$idx];
|
||||
// Last value for value
|
||||
if($idx == sizeof($fieldNameParts) - 1) {
|
||||
if($tmpItem) {
|
||||
$value = ($tmpItem->XML_val($relationMethod) && $xmlSafe) ? $tmpItem->XML_val($relationMethod) : $tmpItem->RAW_val($relationMethod);
|
||||
}
|
||||
// else get the object for the next iteration
|
||||
} else {
|
||||
if($tmpItem) {
|
||||
$tmpItem = $tmpItem->$relationMethod();
|
||||
}
|
||||
}
|
||||
// else get the object for the next iteration
|
||||
} else {
|
||||
if($tmpItem) {
|
||||
$tmpItem = $tmpItem->$relationMethod();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$value = $this->castValue($gridField, $column, $value);
|
||||
|
Loading…
x
Reference in New Issue
Block a user