Completed
Push — master ( f8f77e...d2a4ab )
by Jason
05:01
created

OrderAdmin   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
c 0
b 0
f 0
dl 0
loc 39
ccs 0
cts 7
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getEditForm() 0 14 1
1
<?php
2
3
namespace Dynamic\FoxyStripe\Admin;
4
5
use SilverStripe\Admin\ModelAdmin;
6
7
class OrderAdmin extends ModelAdmin
8
{
9
    /**
10
     * @var array
11
     */
12
    private static $managed_models = array(
0 ignored issues
show
introduced by
The private property $managed_models is not used, and could be removed.
Loading history...
13
        'Order',
14
    );
15
16
    /**
17
     * @var string
18
     */
19
    private static $url_segment = 'orders';
0 ignored issues
show
introduced by
The private property $url_segment is not used, and could be removed.
Loading history...
20
21
    /**
22
     * @var string
23
     */
24
    private static $menu_title = 'Orders';
0 ignored issues
show
introduced by
The private property $menu_title is not used, and could be removed.
Loading history...
25
26
    /**
27
     * @param null $id
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $fields is correct as it would always require null to be passed?
Loading history...
Documentation Bug introduced by
Are you sure the doc-type for parameter $id is correct as it would always require null to be passed?
Loading history...
28
     * @param null $fields
29
     *
30
     * @return \SilverStripe\Forms\Form
31
     */
32
    public function getEditForm($id = null, $fields = null)
33
    {
34
        $form = parent::getEditForm($id, $fields);
35
36
        $gridFieldName = $this->sanitiseClassName($this->modelClass);
37
        $gridField = $form->Fields()->fieldByName($gridFieldName);
38
39
        // GridField configuration
40
        $config = $gridField->getConfig();
41
42
        // remove edit icon
43
        $config->removeComponentsByType('GridFieldEditButton');
44
45
        return $form;
46
    }
47
}
48