mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #492 from ajshort/multisites
Fix ModelAdmin When Managed Models Is Array
This commit is contained in:
commit
f80091f16a
@ -96,14 +96,18 @@ abstract class ModelAdmin extends LeftAndMain {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the model admin interface. Sets up embedded jquery libraries and requisite plugins.
|
* Initialize the model admin interface. Sets up embedded jquery libraries and requisite plugins.
|
||||||
*
|
|
||||||
* @todo remove reliance on urlParams
|
|
||||||
*/
|
*/
|
||||||
public function init() {
|
public function init() {
|
||||||
parent::init();
|
parent::init();
|
||||||
|
|
||||||
$models = $this->getManagedModels();
|
$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
|
// security check for valid models
|
||||||
if(!array_key_exists($this->modelClass, $models)) {
|
if(!array_key_exists($this->modelClass, $models)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user