code/ModelAdmin.php
protected function init()
    {
        parent::init();

        $models = $this->getManagedModels();

        if ($this->getRequest()->param('ModelClass')) {
            $this->modelClass = $this->unsanitiseClassName($this->getRequest()->param('ModelClass'));
        } else {
            reset($models);
            $this->modelClass = key($models);
        }

        // security check for valid models
        if (!array_key_exists($this->modelClass, $models)) {
            user_error('ModelAdmin::init(): Invalid Model class', E_USER_ERROR);
        }
    }
protected function init()
    {
        parent::init();

        $models = $this->getManagedModels();

        if ($this->getRequest()->param('ModelClass')) {
            $this->modelClass = $this->unsanitiseClassName($this->getRequest()->param('ModelClass'));
        } else {
            reset($models);
            $this->modelClass = key($models);
        }

        // security check for valid models
        if (!array_key_exists($this->modelClass, $models)) {
            user_error('ModelAdmin::init(): Invalid Model class', E_USER_ERROR);
        }
    }
protected function init ( ) { parent :: init ( ) ; $ models = $ this -> getManagedModels ( ) ; if ( $ this -> getRequest ( ) -> param ( 'ModelClass' ) ) { $ this -> modelClass = $ this -> unsanitiseClassName ( $ this -> getRequest ( ) -> param ( 'ModelClass' ) ) ; } else { reset ( $ models ) ; $ this -> modelClass = key ( $ models ) ; } // security check for valid models if ( ! array_key_exists ( $ this -> modelClass , $ models ) ) { user_error ( 'ModelAdmin::init(): Invalid Model class' , E_USER_ERROR ) ; } }
Initialize the model admin interface. Sets up embedded jquery libraries and requisite plugins.

Sets the `modelClass` field which determines which of the {@link DataObject} objects will have visible data. This
is determined by the URL (with the first slug being the name of the DataObject class to represent. If this class
is loaded without any URL, we pick the first DataObject from the list of {@link self::$managed_models}.
Initialize the model admin interface . Sets up embedded jquery libraries and requisite plugins .