Skip to content

Commit

Permalink
BUGFIX Fixed GridField->setFieldFormatting()
Browse files Browse the repository at this point in the history
  • Loading branch information
chillu committed Jan 9, 2012
1 parent 8a8f741 commit d4bde47
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions forms/gridfield/GridFieldDefaultColumns.php
Expand Up @@ -31,23 +31,24 @@ public function getColumnContent($gridField, $item, $column) {


// This supports simple FieldName syntax // This supports simple FieldName syntax
if(strpos($fieldName, '.') === false) { if(strpos($fieldName, '.') === false) {
return ($item->XML_val($fieldName) && $xmlSafe) ? $item->XML_val($fieldName) : $item->RAW_val($fieldName); $value = ($item->XML_val($fieldName) && $xmlSafe) ? $item->XML_val($fieldName) : $item->RAW_val($fieldName);
} } else {
$fieldNameParts = explode('.', $fieldName); $fieldNameParts = explode('.', $fieldName);
$tmpItem = $item; $tmpItem = $item;
for($idx = 0; $idx < sizeof($fieldNameParts); $idx++) { for($idx = 0; $idx < sizeof($fieldNameParts); $idx++) {
$relationMethod = $fieldNameParts[$idx]; $relationMethod = $fieldNameParts[$idx];
// Last value for value // Last value for value
if($idx == sizeof($fieldNameParts) - 1) { if($idx == sizeof($fieldNameParts) - 1) {
if($tmpItem) { if($tmpItem) {
return ($tmpItem->XML_val($relationMethod) && $xmlSafe) ? $tmpItem->XML_val($relationMethod) : $tmpItem->RAW_val($relationMethod); $value = ($tmpItem->XML_val($relationMethod) && $xmlSafe) ? $tmpItem->XML_val($relationMethod) : $tmpItem->RAW_val($relationMethod);
} }
// else get the object for the next iteration // else get the object for the next iteration
} else { } else {
if($tmpItem) { if($tmpItem) {
$tmpItem = $tmpItem->$relationMethod(); $tmpItem = $tmpItem->$relationMethod();
}
} }
} }
} }


$value = $this->castValue($gridField, $column, $value); $value = $this->castValue($gridField, $column, $value);
Expand Down

0 comments on commit d4bde47

Please sign in to comment.