GalleryPageImageExtension::updateCMSFields()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 1
1
<?php
2
3
class GalleryPageImageExtension extends DataExtension
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
4
{
5
    /**
6
     * @var array
7
     */
8
    private static $db = array(
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...
9
        'Caption' => 'varchar',
10
    );
11
12
    /**
13
     * @var array
14
     */
15
    private static $belongs_many_many = array(
0 ignored issues
show
Unused Code introduced by
The property $belongs_many_many 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
        'Image' => 'GalleryPage'
17
    );
18
19
    /**
20
     * @param FieldList
21
     */
22
    public function updateCMSFields(FieldList $fields)
23
    {
24
        $fields->addFieldToTab(
25
            'Root.Main',
26
            TextField::create('Caption', 'Caption', $this->owner->Caption),
27
            'Title'
28
        );
29
    }
30
}
31