mirror of
https://github.com/symbiote/silverstripe-gridfieldextensions.git
synced 2024-10-22 15:05:39 +00:00
Adding RelationData (HasManyList) into record to generate FormFields. So Relations on new data object are available in getCMSFields()
This commit is contained in:
parent
5eec0f70b4
commit
6818ed1908
@ -129,8 +129,15 @@ class GridFieldAddNewMultiClass implements GridField_HTMLProvider, GridField_URL
|
|||||||
throw new SS_HTTPResponse_Exception(400);
|
throw new SS_HTTPResponse_Exception(400);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$record = new $class();
|
||||||
|
$List = $grid->getList();
|
||||||
|
if ($List && $List->is_a('HasManyList')) {
|
||||||
|
$fk = $List->getForeignKey();
|
||||||
|
$record->$fk = $List->getForeignID();
|
||||||
|
}
|
||||||
|
|
||||||
$handler = new GridFieldAddNewMultiClassHandler(
|
$handler = new GridFieldAddNewMultiClassHandler(
|
||||||
$grid, $component, new $class(), $grid->getForm()->getController(), 'add-multi-class'
|
$grid, $component, $record, $grid->getForm()->getController(), 'add-multi-class'
|
||||||
);
|
);
|
||||||
$handler->setTemplate($component->getTemplate());
|
$handler->setTemplate($component->getTemplate());
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user