Passed
Pull Request — master (#32)
by
unknown
02:59 queued 01:02
created

CKANRegistryPage::getCMSFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace SilverStripe\CKANRegistry\Page;
4
5
use Page;
0 ignored issues
show
Bug introduced by
The type Page 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...
6
use SilverStripe\CKANRegistry\Forms\ResourceLocatorField;
7
use SilverStripe\Forms\FieldList;
8
use SilverStripe\Forms\TextField;
9
10
/**
11
 * A CKANRegistryPage will render a chosen CKAN data set on the frontend, provide the user with configurable filters
12
 * and display a set of CMS configured columns.
13
 */
14
class CKANRegistryPage extends Page
15
{
16
    private static $table_name = 'CKANRegistryPage';
0 ignored issues
show
introduced by
The private property $table_name is not used, and could be removed.
Loading history...
17
18
    private static $db = [
0 ignored issues
show
introduced by
The private property $db is not used, and could be removed.
Loading history...
19
        'ItemsPerPage' => 'Int',
20
    ];
21
22
    private static $defaults = [
0 ignored issues
show
introduced by
The private property $defaults is not used, and could be removed.
Loading history...
23
        'ItemsPerPage' => 20,
24
    ];
25
26
    private static $singular_name = 'CKAN Registry Page';
0 ignored issues
show
introduced by
The private property $singular_name is not used, and could be removed.
Loading history...
27
28
    private static $plural_name = 'CKAN Registry Pages';
0 ignored issues
show
introduced by
The private property $plural_name is not used, and could be removed.
Loading history...
29
30
    public function getCMSFields()
31
    {
32
        $this->beforeUpdateCMSFields(function (FieldList $fields) {
33
            $fields->addFieldToTab('Root.Data', ResourceLocatorField::create('Thing'));
34
        });
35
36
        return parent::getCMSFields();
37
    }
38
39
    public function getSettingsFields()
40
    {
41
        $fields = parent::getSettingsFields();
42
43
        $fields->addFieldsToTab('Root.Settings', [
44
            TextField::create('ItemsPerPage', _t(__CLASS__ . '.ItemsPerPage', 'Items per page')),
45
        ]);
46
47
        return $fields;
48
    }
49
}
50