From 08f89ea4b546ee2fe011dac5eeedba8e81b68801 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Fri, 7 Aug 2020 12:30:21 +1200 Subject: [PATCH] FIX: Fixed handling of uneditable records in GridFieldEditableColumns Fixes #312 --- src/GridFieldEditableColumns.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/GridFieldEditableColumns.php b/src/GridFieldEditableColumns.php index 7dc89cf..cffba22 100644 --- a/src/GridFieldEditableColumns.php +++ b/src/GridFieldEditableColumns.php @@ -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(); }