Skip to content

Commit

Permalink
FIX Allow editing extra fields from ManyManyThroughList.
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Aug 20, 2023
1 parent 1284046 commit 47171ee
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/GridFieldEditableColumns.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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());
}

Expand Down Expand Up @@ -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 ?? [])) {
Expand Down

0 comments on commit 47171ee

Please sign in to comment.