FIX Allow editing extra fields from ManyManyThroughList.

This commit is contained in:
Guy Sartorelli 2023-08-15 10:45:42 +12:00
parent 1284046e10
commit 47171ee4c2
No known key found for this signature in database
GPG Key ID: F313E3B9504D496A

View File

@ -24,6 +24,7 @@ use SilverStripe\ORM\DataList;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DataObjectInterface; use SilverStripe\ORM\DataObjectInterface;
use SilverStripe\ORM\ManyManyList; use SilverStripe\ORM\ManyManyList;
use SilverStripe\ORM\ManyManyThroughList;
/** /**
* Allows inline editing of grid field records without having to load a separate * Allows inline editing of grid field records without having to load a separate
@ -165,7 +166,7 @@ class GridFieldEditableColumns extends GridFieldDataColumns implements
} }
} }
if ($list instanceof ManyManyList) { if ($list instanceof ManyManyList || $list instanceof ManyManyThroughList) {
$extra = array_intersect_key($form->getData() ?? [], (array) $list->getExtraFields()); $extra = array_intersect_key($form->getData() ?? [], (array) $list->getExtraFields());
} }
@ -250,7 +251,7 @@ class GridFieldEditableColumns extends GridFieldDataColumns implements
} }
} }
if (!$field && $list instanceof ManyManyList) { if (!$field && ($list instanceof ManyManyList || $list instanceof ManyManyThroughList)) {
$extra = $list->getExtraFields(); $extra = $list->getExtraFields();
if ($extra && array_key_exists($col, $extra ?? [])) { if ($extra && array_key_exists($col, $extra ?? [])) {