Completed
Push — master ( 24a953...721964 )
by Robbie
12s
created

TaxonomyTermExtension::updateCMSFields()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
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) {
0 ignored issues
show
introduced by
$pagesGridField is of type SilverStripe\Forms\FormField, thus it always evaluated to true.
Loading history...
23
            $pagesGridField->getConfig()->removeComponentsByType(GridFieldAddNewButton::class);
24
        }
25
    }
26
}
27