Compare commits

...

4 Commits

Author SHA1 Message Date
Niklas Forsdahl 98a6c6e41b
Merge a9b0a70155 into 256d06b36c 2024-05-07 18:21:42 +03:00
Niklas Forsdahl a9b0a70155 Throw 404 error on grid field nested form move-to-parent action,
if no record is found.
2024-05-07 18:20:56 +03:00
Niklas Forsdahl 8f505659f0 Only add nested form to nested gridfield child if that child is of
the same class as the parent record.
2024-05-07 18:02:06 +03:00
Guy Sartorelli 256d06b36c
TLN Update translations (#385) 2024-05-06 18:13:32 +12:00
3 changed files with 4 additions and 2 deletions

View File

@ -14,3 +14,5 @@ en:
NEW: 'Add new record'
Symbiote\GridFieldExtensions\GridFieldConfigurablePaginator:
SHOW: Show
Symbiote\GridFieldExtensions\GridFieldOrderableRows:
REORDERED: 'Records reordered.'

View File

@ -288,7 +288,7 @@ class GridFieldNestedForm extends AbstractGridFieldComponent implements
$list = $gridField->getList();
$id = isset($move['id']) ? (int) $move['id'] : null;
if (!$id) {
throw new HTTPResponse_Exception('Missing ID', 400);
throw new HTTPResponse_Exception('Missing ID', 404);
}
$to = isset($move['parent']) ? (int)$move['parent'] : null;
// should be possible either on parent or child grid field, or nested grid field from parent

View File

@ -73,7 +73,7 @@ class GridFieldNestedFormItemRequest extends GridFieldDetailForm_ItemRequest
}
}
if ($this->record->hasExtension(Hierarchy::class)) {
if ($this->record->hasExtension(Hierarchy::class) && $relationClass == get_class($this->record)) {
$config->addComponent($nestedForm = new GridFieldNestedForm(), GridFieldOrderableRows::class);
// use max nesting level from parent component
$nestedForm->setMaxNestingLevel($this->component->getMaxNestingLevel());