Completed
Push — master ( 59c799...149ad0 )
by Will
02:15
created

ElementalAdmin::getList()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
/**
4
 * @package elemental
5
 */
6
class ElementalAdmin extends ModelAdmin {
0 ignored issues
show
Coding Style Compatibility introduced by Will Rossiter
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
7
8
    private static $managed_models = array(
0 ignored issues
show
Comprehensibility introduced by Will Rossiter
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by Will Rossiter
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...
9
        'BaseElement'
10
    );
11
12
    private static $menu_title = 'Content Blocks';
0 ignored issues
show
Comprehensibility introduced by Will Rossiter
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by Will Rossiter
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...
13
14
    private static $url_segment = 'elemental';
0 ignored issues
show
Comprehensibility introduced by Will Rossiter
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by Will Rossiter
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...
15
16
    private static $menu_icon = "elemental/images/blocks.svg";
0 ignored issues
show
Comprehensibility introduced by Will Rossiter
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by Will Rossiter
The property $menu_icon 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
    public function getEditForm($id = null, $fields = null) {
0 ignored issues
show
Documentation introduced by Will Rossiter
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
19
        $form = parent::getEditForm($id, $fields);
20
21
        $grid = $form->Fields()
22
            ->dataFieldByName($this->sanitiseClassName($this->modelClass));
23
24
        $grid->getConfig()->removeComponentsByType('GridFieldAddNewButton');
25
26
        return $form;
27
    }
28
29
    /**
30
     * Exclude our linked elements
31
     *
32
     * @return DataList
33
     */
34
    public function getList() {
35
        $list = parent::getList();
36
        $list = $list->exclude('ClassName', 'ElementVirtualLinked');
37
38
        return $list;
39
    }
40
}
41