Completed
Pull Request — master (#264)
by Robbie
13:29
created

TranslatableTestPage   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 32
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getCMSFields() 0 16 1
1
<?php
2
3
namespace SilverStripe\Translatable\Tests\Stub;
4
5
use Page;
6
use SilverStripe\Dev\TestOnly;
7
use SilverStripe\Forms\DropdownField;
8
use SilverStripe\Forms\TextField;
9
10
class TranslatableTestPage extends Page implements TestOnly
11
{
12
    // static $extensions is inherited from SiteTree,
13
    // we don't need to explicitly specify the fields
14
15
    private static $db = [
0 ignored issues
show
Unused Code introduced by
The property $db is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
16
        'TranslatableProperty' => 'Text'
17
    ];
18
19
    private static $has_one = [
0 ignored issues
show
Unused Code introduced by
The property $has_one is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
20
        'TranslatableObject' => TranslatableTestDataObject::class
21
    ];
22
23
    private static $table_name = 'TranslatableTestPage';
0 ignored issues
show
Unused Code introduced by
The property $table_name is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
24
25
    public function getCMSFields()
26
    {
27
        $fields = parent::getCMSFields();
28
        $fields->addFieldToTab(
29
            'Root.Main',
30
            new TextField('TranslatableProperty')
31
        );
32
        $fields->addFieldToTab(
33
            'Root.Main',
34
            new DropdownField('TranslatableObjectID')
35
        );
36
37
        $this->applyTranslatableFieldsUpdate($fields, 'updateCMSFields');
38
39
        return $fields;
40
    }
41
}
42