FIX: Fixed handling of uneditable records in GridFieldEditableColumns

Fixes #312
This commit is contained in:
Sam Minnee 2020-08-07 12:30:21 +12:00
parent c77d9d1de3
commit 08f89ea4b5

View File

@ -56,10 +56,6 @@ class GridFieldEditableColumns extends GridFieldDataColumns implements
public function getColumnContent($grid, $record, $col)
{
if (!$record->canEdit()) {
return parent::getColumnContent($grid, $record, $col);
}
$fields = $this->getForm($grid, $record)->Fields();
if (!$this->displayFields) {
@ -104,6 +100,10 @@ class GridFieldEditableColumns extends GridFieldDataColumns implements
$field->setName($this->getFieldName($field->getName(), $grid, $record));
$field->setValue($value);
if (!$record->canEdit()) {
$field = $field->performReadonlyTransformation();
}
if ($field instanceof HtmlEditorField) {
return $field->FieldHolder();
}