mirror of
https://github.com/symbiote/silverstripe-gridfieldextensions.git
synced 2024-10-22 17:05:39 +02:00
FIX Forms now instantiate fields with correct record context on save
This commit is contained in:
parent
ff12337e6e
commit
ef354511d7
@ -147,7 +147,6 @@ class GridFieldAddNewInlineButton implements GridField_HTMLProvider, GridField_S
|
|||||||
$editable = $grid->getConfig()->getComponentByType('GridFieldEditableColumns');
|
$editable = $grid->getConfig()->getComponentByType('GridFieldEditableColumns');
|
||||||
/** @var GridFieldOrderableRows $sortable */
|
/** @var GridFieldOrderableRows $sortable */
|
||||||
$sortable = $grid->getConfig()->getComponentByType('GridFieldOrderableRows');
|
$sortable = $grid->getConfig()->getComponentByType('GridFieldOrderableRows');
|
||||||
$form = $editable->getForm($grid, $record);
|
|
||||||
|
|
||||||
if(!singleton($class)->canCreate()) {
|
if(!singleton($class)->canCreate()) {
|
||||||
return;
|
return;
|
||||||
@ -157,6 +156,7 @@ class GridFieldAddNewInlineButton implements GridField_HTMLProvider, GridField_S
|
|||||||
$item = $class::create();
|
$item = $class::create();
|
||||||
$extra = array();
|
$extra = array();
|
||||||
|
|
||||||
|
$form = $editable->getForm($grid, $item);
|
||||||
$form->loadDataFrom($fields, Form::MERGE_CLEAR_MISSING);
|
$form->loadDataFrom($fields, Form::MERGE_CLEAR_MISSING);
|
||||||
$form->saveInto($item);
|
$form->saveInto($item);
|
||||||
|
|
||||||
|
@ -94,8 +94,6 @@ class GridFieldEditableColumns extends GridFieldDataColumns implements
|
|||||||
/** @var GridFieldOrderableRows $sortable */
|
/** @var GridFieldOrderableRows $sortable */
|
||||||
$sortable = $grid->getConfig()->getComponentByType('GridFieldOrderableRows');
|
$sortable = $grid->getConfig()->getComponentByType('GridFieldOrderableRows');
|
||||||
|
|
||||||
$form = $this->getForm($grid, $record);
|
|
||||||
|
|
||||||
foreach($value[__CLASS__] as $id => $fields) {
|
foreach($value[__CLASS__] as $id => $fields) {
|
||||||
if(!is_numeric($id) || !is_array($fields)) {
|
if(!is_numeric($id) || !is_array($fields)) {
|
||||||
continue;
|
continue;
|
||||||
@ -107,6 +105,8 @@ class GridFieldEditableColumns extends GridFieldDataColumns implements
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$form = $this->getForm($grid, $item);
|
||||||
|
|
||||||
$extra = array();
|
$extra = array();
|
||||||
|
|
||||||
$form->loadDataFrom($fields, Form::MERGE_CLEAR_MISSING);
|
$form->loadDataFrom($fields, Form::MERGE_CLEAR_MISSING);
|
||||||
|
Loading…
Reference in New Issue
Block a user