From a42cd4378042a0b8ea416a079f20b3f57470e15b Mon Sep 17 00:00:00 2001 From: Niklas Forsdahl Date: Wed, 15 May 2024 09:03:32 +0300 Subject: [PATCH] Only allow one GridFieldNestedForm component per GridField. --- src/GridFieldNestedForm.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/GridFieldNestedForm.php b/src/GridFieldNestedForm.php index cb3015c..9f4fffc 100644 --- a/src/GridFieldNestedForm.php +++ b/src/GridFieldNestedForm.php @@ -207,6 +207,9 @@ class GridFieldNestedForm extends AbstractGridFieldComponent implements 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 ''; }