TaxonomyTermExtension   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 14
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A updateCMSFields() 0 5 2
1
<?php
2
3
namespace CWP\CWP\Extensions;
4
5
use CWP\CWP\PageTypes\BasePage;
6
use SilverStripe\ORM\DataExtension;
7
use SilverStripe\Forms\FieldList;
8
use SilverStripe\Forms\GridField\GridFieldAddNewButton;
9
10
class TaxonomyTermExtension extends DataExtension
11
{
12
13
    private static $api_access = true;
0 ignored issues
show
introduced by
The private property $api_access is not used, and could be removed.
Loading history...
14
15
    private static $belongs_many_many = array(
0 ignored issues
show
introduced by
The private property $belongs_many_many is not used, and could be removed.
Loading history...
16
        'Pages' => BasePage::class
17
    );
18
19
    public function updateCMSFields(FieldList $fields)
20
    {
21
        $pagesGridField = $fields->dataFieldByName('Pages');
22
        if ($pagesGridField) {
23
            $pagesGridField->getConfig()->removeComponentsByType(GridFieldAddNewButton::class);
24
        }
25
    }
26
}
27