From 47171ee4c25f552fb7bac80c1666775c24bcaac0 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Tue, 15 Aug 2023 10:45:42 +1200 Subject: [PATCH] FIX Allow editing extra fields from ManyManyThroughList. --- src/GridFieldEditableColumns.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/GridFieldEditableColumns.php b/src/GridFieldEditableColumns.php index c48eb16..e42be98 100644 --- a/src/GridFieldEditableColumns.php +++ b/src/GridFieldEditableColumns.php @@ -24,6 +24,7 @@ use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\ManyManyList; +use SilverStripe\ORM\ManyManyThroughList; /** * Allows inline editing of grid field records without having to load a separate @@ -165,7 +166,7 @@ public function handleSave(GridField $grid, DataObjectInterface $record) } } - if ($list instanceof ManyManyList) { + if ($list instanceof ManyManyList || $list instanceof ManyManyThroughList) { $extra = array_intersect_key($form->getData() ?? [], (array) $list->getExtraFields()); } @@ -250,7 +251,7 @@ public function getFields(GridField $grid, DataObjectInterface $record) } } - if (!$field && $list instanceof ManyManyList) { + if (!$field && ($list instanceof ManyManyList || $list instanceof ManyManyThroughList)) { $extra = $list->getExtraFields(); if ($extra && array_key_exists($col, $extra ?? [])) {