Suppose you have a ModelAdmin with two managed models.
class MyAdmin extends ModelAdmin {
private static $managed_models = array(
'Product',
'Category'
);
public function getEditForm($id = null, $fields = null) {
$form = parent::getEditForm($id, $fields);
$model = $this->sanitiseClassName($this->modelClass);
// Sophisticated debug trick :-)
die(var_dump($model)); // This will output string(7) "Product"
return $form;
}
}
I find it strange that $this->modelClass holds just one model and not both, which makes me wonder if getEditForm() works the same way as getCMSFields(). Does getEditForm() execution iterate over the given models?
The reason for asking is because eventually my goal is to merge the two seperated model gridfields under one tab and I'm not sure if I'm working in the right class method.