Completed
Push — master ( 60b259...83077f )
by Will
01:57
created

code/admin/SubsiteAdmin.php (9 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace SilverStripe\Subsites\Admin;
4
5
use SilverStripe\Admin\ModelAdmin;
6
use SilverStripe\Subsites\Forms\GridFieldSubsiteDetailForm;
7
use SilverStripe\Subsites\Model\Subsite;
8
9
/**
10
 * Admin interface to manage and create {@link Subsite} instances.
11
 *
12
 * @package subsites
13
 */
14
class SubsiteAdmin extends ModelAdmin
15
{
16
    private static $managed_models = [Subsite::class];
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
The property $managed_models is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
17
18
    private static $url_segment = 'subsites';
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
The property $url_segment is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
19
20
    private static $menu_title = 'Subsites';
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
The property $menu_title is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
21
22
    private static $menu_icon_class = 'font-icon-tree';
0 ignored issues
show
The property $menu_icon_class is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
23
24
    public $showImportForm = false;
25
26
    private static $tree_class = Subsite::class;
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
The property $tree_class is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
27
28
    public function getEditForm($id = null, $fields = null)
29
    {
30
        $form = parent::getEditForm($id, $fields);
31
32
        $grid = $form->Fields()->dataFieldByName(Subsite::class);
33
        if ($grid) {
34
            $grid->getConfig()->removeComponentsByType(GridFieldDetailForm::class);
35
            $grid->getConfig()->addComponent(new GridFieldSubsiteDetailForm());
36
        }
37
38
        return $form;
39
    }
40
}
41