Completed
Push — master ( a48538...a41cf8 )
by Nicolaas
03:21
created

ProductsAndGroupsModelAdmin   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 35
rs 10
c 0
b 0
f 0
wmc 5
lcom 1
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
B getEditForm() 0 13 5
1
<?php
2
3
4
/**
5
 * @description: for the management of Product and Product Groups only
6
 *
7
 *
8
 * @authors: Nicolaas [at] Sunny Side Up .co.nz
9
 * @package: ecommerce
10
 * @sub-package: cms
11
 **/
12
class ProductsAndGroupsModelAdmin extends ModelAdminEcommerceBaseClass
0 ignored issues
show
Coding Style Compatibility introduced by
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...
13
{
14
    private static $menu_priority = 3.2;
0 ignored issues
show
Unused Code introduced by
The property $menu_priority 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...
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
15
16
    private static $url_segment = 'products';
0 ignored issues
show
Unused Code introduced by
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...
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
17
18
    private static $menu_title = 'Products';
0 ignored issues
show
Unused Code introduced by
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...
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
19
20
    private static $allowed_actions = array(
0 ignored issues
show
Unused Code introduced by
The property $allowed_actions 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...
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
21
        'editinsitetree',
22
        'ItemEditForm',
23
    );
24
25
    /**
26
     * standard SS variable.
27
     *
28
     * @var string
29
     */
30
    private static $menu_icon = 'ecommerce/images/icons/product-file.gif';
0 ignored issues
show
Unused Code introduced by
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...
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
31
32
33
    public function getEditForm($id = null, $fields = null)
0 ignored issues
show
Documentation introduced by
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...
34
    {
35
        $form = parent::getEditForm();
36
        if (is_subclass_of($this->modelClass, 'SiteTree') || $this->modelClass === 'SiteTree') {
37
            if ($gridField = $form->Fields()->dataFieldByName($this->sanitiseClassName($this->modelClass))) {
38
                if ($gridField instanceof GridField) {
39
                    $gridField->setConfig(GridFieldEditOriginalPageConfig::create());
40
                }
41
            }
42
        }
43
44
        return $form;
45
    }
46
}
47