Passed
Pull Request — master (#51)
by
unknown
02:09
created

ResourceDropdownFilter   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getCMSFields() 0 12 1
1
<?php
2
3
namespace SilverStripe\CKANRegistry\Model;
4
5
use SilverStripe\Forms\DropdownField;
6
use SilverStripe\Forms\TextField;
7
8
class ResourceDropdownFilter extends ResourceFilter
9
{
10
    private static $db = [
0 ignored issues
show
introduced by
The private property $db is not used, and could be removed.
Loading history...
11
        'Options' => 'Varchar'
12
    ];
13
14
    private static $singular_name = 'Dropdown Filter';
0 ignored issues
show
introduced by
The private property $singular_name is not used, and could be removed.
Loading history...
15
16
    protected $fieldType = DropdownField::class;
17
18
    public function getCMSFields()
19
    {
20
        $this->beforeUpdateCMSFields(function (FieldList $fields) {
0 ignored issues
show
Bug introduced by
The type SilverStripe\CKANRegistry\Model\FieldList was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
21
            $fields->push(TextField::create(
22
                'Options',
23
                _t(__CLASS__ . '.Options', 'Dropdown options')
24
            ));
25
26
            $fields->removeByName('FilterForID');
27
        });
28
29
        return parent::getCMSFields();
30
    }
31
}