forked from silverstripe/silverstripe-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMultiModelAdmin.php
More file actions
45 lines (38 loc) · 1.19 KB
/
MultiModelAdmin.php
File metadata and controls
45 lines (38 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
namespace SilverStripe\Admin\Tests\ModelAdminTest;
use SilverStripe\Admin\ModelAdmin;
use SilverStripe\Control\Controller;
use SilverStripe\Dev\TestOnly;
class MultiModelAdmin extends ModelAdmin implements TestOnly
{
private static $url_segment = 'multi';
private static $managed_models = [
Contact::class,
'Player' => [
'dataClass' => Player::class,
'title' => 'Ice Hockey Players'
],
Player::class => [
'title' => 'Rugby Players'
]
];
private static $model_importers = [
// Infer Contact importer
// Contact::class,
'Player' => ModelAdminTestBulkLoader::class,
Player::class => ModelAdminTestBulkLoader::class,
];
public function Link($action = null)
{
if (!$action) {
$action = $this->sanitiseClassName($this->modelClass);
}
return Controller::join_links('ContactAdmin', $action, '/');
}
// The purpose of this method is to increase the visibility of ModelAdmin::getManagedModelTabs()
// from protected to public
public function getManagedModelTabs()
{
return parent::getManagedModelTabs();
}
}