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