Permalink
Browse files

MINOR GridField compat with ViewableData records (fixes #7479)

Only use relField() when it exists (usually on DataObject),
otherwise fall back to method or value returns
(same as original GridFieldDataColumns behaviour).
  • Loading branch information...
1 parent 88582e7 commit 02332da7fb20026baac7f54dc12db8f08cc0c188 @chillu chillu committed Jun 15, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 forms/gridfield/GridField.php
@@ -438,7 +438,13 @@ public function getDataFieldValue($record, $fieldName) {
}
// Default implementation
- return $record->relField($fieldName);
+ if($record->hasMethod('relField')) {
+ return $record->relField($fieldName);
+ } elseif($record->hasMethod($fieldName)) {
+ return $record->$fieldName();
+ } else {
+ return $record->$fieldName;
+ }
}
/**

0 comments on commit 02332da

Please sign in to comment.