Skip to content

Commit

Permalink
Merge pull request #372 from creative-commoners/pulls/3.6/manymanythr…
Browse files Browse the repository at this point in the history
…ough-editablecolumns

FIX Allow editing extra fields from ManyManyThroughList.
  • Loading branch information
kinglozzer authored Aug 21, 2023
2 parents 1e5a1e8 + 47171ee commit e7d7178
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 e7d7178

Please sign in to comment.