Skip to content

Commit

Permalink
Only allow one GridFieldNestedForm component per GridField.
Browse files Browse the repository at this point in the history
  • Loading branch information
forsdahl committed May 15, 2024
1 parent c476ced commit a42cd43
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/GridFieldNestedForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ public function augmentColumns($gridField, &$columns)

public function getColumnContent($gridField, $record, $columnName)
{
if ($gridField->getConfig()->getComponentsByType(GridFieldNestedForm::class)->count() > 1) {
throw new Exception('Only one GridFieldNestedForm component allowed per GridField');
}
if ($this->atMaxNestingLevel($gridField)) {
return '';
}
Expand Down

0 comments on commit a42cd43

Please sign in to comment.