Passed
Push — master ( 72198b...d1ce69 )
by Thomas
02:46
created

SubsiteAdmin::getEditForm()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 10
rs 10
1
<?php
2
3
namespace LeKoala\Admini\Subsites;
4
5
use LeKoala\Admini\ModelAdmin;
6
use LeKoala\Admini\MaterialIcons;
7
use SilverStripe\Subsites\Model\Subsite;
0 ignored issues
show
Bug introduced by
The type SilverStripe\Subsites\Model\Subsite was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use SilverStripe\Subsites\State\SubsiteState;
0 ignored issues
show
Bug introduced by
The type SilverStripe\Subsites\State\SubsiteState was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use SilverStripe\Subsites\Forms\GridFieldSubsiteDetailForm;
0 ignored issues
show
Bug introduced by
The type SilverStripe\Subsites\Fo...dFieldSubsiteDetailForm was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
11
/**
12
 * Admin interface to manage and create {@link Subsite} instances.
13
 *
14
 * @package subsites
15
 */
16
class SubsiteAdmin extends ModelAdmin
17
{
18
    private static $managed_models = [Subsite::class];
0 ignored issues
show
introduced by
The private property $managed_models is not used, and could be removed.
Loading history...
19
20
    private static $url_segment = 'subsites';
21
22
    private static $menu_title = 'Subsites';
23
24
    private static $menu_icon = MaterialIcons::ACCOUNT_TREE;
0 ignored issues
show
introduced by
The private property $menu_icon is not used, and could be removed.
Loading history...
25
26
    public $showImportForm = false;
27
28
    private static $tree_class = Subsite::class;
29
30
    public function canView($member = null)
31
    {
32
        if (!class_exists(SubsiteState::class)) {
33
            return false;
34
        }
35
        return parent::canView($member);
36
    }
37
38
    public function getEditForm($id = null, $fields = null)
39
    {
40
        $form = parent::getEditForm($id, $fields);
41
42
        $grid = $form->Fields()->dataFieldByName(str_replace('\\', '-', Subsite::class));
43
        if ($grid) {
44
            $grid->setItemRequestClass(TabulatorSubsiteDetailFormItemRequest::class);
45
        }
46
47
        return $form;
48
    }
49
}
50