Adding RelationData (HasManyList) into record to generate FormFields. So Relations on new data object are available in getCMSFields()

This commit is contained in:
Malte Jansen 2013-12-05 11:52:38 +01:00
parent 5eec0f70b4
commit 6818ed1908

View File

@ -129,8 +129,15 @@ class GridFieldAddNewMultiClass implements GridField_HTMLProvider, GridField_URL
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(
$grid, $component, new $class(), $grid->getForm()->getController(), 'add-multi-class'
$grid, $component, $record, $grid->getForm()->getController(), 'add-multi-class'
);
$handler->setTemplate($component->getTemplate());