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

TranslatableTestPage::getCMSFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 10
nc 1
nop 0
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