mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX: Fixed ModelAdmin not working when managed models was defined as an array.
This commit is contained in:
parent
497aa9bfa9
commit
b7ce610933
@ -96,14 +96,18 @@ abstract class ModelAdmin extends LeftAndMain {
|
||||
|
||||
/**
|
||||
* Initialize the model admin interface. Sets up embedded jquery libraries and requisite plugins.
|
||||
*
|
||||
* @todo remove reliance on urlParams
|
||||
*/
|
||||
public function init() {
|
||||
parent::init();
|
||||
|
||||
$models = $this->getManagedModels();
|
||||
$this->modelClass = (isset($this->urlParams['ModelClass'])) ? $this->urlParams['ModelClass'] : key($models);
|
||||
|
||||
if($this->request->param('ModelClass')) {
|
||||
$this->modelClass = $this->request->param('ModelClass');
|
||||
} else {
|
||||
reset($models);
|
||||
$this->modelClass = key($models);
|
||||
}
|
||||
|
||||
// security check for valid models
|
||||
if(!array_key_exists($this->modelClass, $models)) {
|
||||
|
Loading…
Reference in New Issue
Block a user