support and cast relationship references as ReadonlyField

This commit is contained in:
Brice Burgess 2014-12-06 16:37:44 -05:00
parent dd5a1036d0
commit 0f3f4855db

View File

@ -30,7 +30,8 @@ class GridFieldEditableColumns extends GridFieldDataColumns implements
$fields = $this->getForm($grid, $record)->Fields(); $fields = $this->getForm($grid, $record)->Fields();
$value = $grid->getDataFieldValue($record, $col); $value = $grid->getDataFieldValue($record, $col);
$field = clone $fields->fieldByName($col); $rel = (strpos($col,'.') == false); // field references a relation value
$field = ($rel) ? clone $fields->fieldByName($col) : new ReadonlyField($col);
if(!$field) { if(!$field) {
throw new Exception("Could not find the field '$col'"); throw new Exception("Could not find the field '$col'");