Permalink
Browse files

BUGFIX Fixed GridField->setFieldFormatting()

  • Loading branch information...
1 parent 8a8f741 commit d4bde4794498264fe6025e1fc16edc96f7ce2f60 @chillu chillu committed Jan 9, 2012
Showing with 17 additions and 16 deletions.
  1. +17 −16 forms/gridfield/GridFieldDefaultColumns.php
@@ -31,23 +31,24 @@ public function getColumnContent($gridField, $item, $column) {
// 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);
- }
- // else get the object for the next iteration
- } else {
- if($tmpItem) {
- $tmpItem = $tmpItem->$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();
+ }
}
- }
+ }
}
$value = $this->castValue($gridField, $column, $value);

0 comments on commit d4bde47

Please sign in to comment.