Completed
Push — master ( b08fc7...3fe51b )
by Robbie
25s queued 11s
created

Dropdown::getCMSFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 10
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SilverStripe\CKANRegistry\Model\ResourceFilter;
4
5
use SilverStripe\CKANRegistry\Model\ResourceFilter;
6
use SilverStripe\Forms\DropdownField;
7
use SilverStripe\Forms\FieldList;
8
use SilverStripe\Forms\TextField;
9
10
/**
11
 * Provides a single select option for CKAN resources to be filtered by
12
 */
13
class Dropdown extends ResourceFilter
14
{
15
    private static $db = [
0 ignored issues
show
introduced by
The private property $db is not used, and could be removed.
Loading history...
16
        'Options' => 'Varchar',
17
    ];
18
19
    private static $table_name = 'CKANFilter_Dropdown';
0 ignored issues
show
introduced by
The private property $table_name is not used, and could be removed.
Loading history...
20
21
    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...
22
23
    protected $fieldType = DropdownField::class;
24
25
    public function getCMSFields()
26
    {
27
        $this->beforeUpdateCMSFields(function (FieldList $fields) {
28
            $fields->push(TextField::create(
29
                'Options',
30
                _t(__CLASS__ . '.Options', 'Dropdown options')
31
            ));
32
        });
33
34
        return parent::getCMSFields();
35
    }
36
}
37