Completed
Pull Request — master (#185)
by Janne
03:01
created

CommentsGridField::newRow()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 16
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 1
Metric Value
c 3
b 0
f 1
dl 0
loc 16
rs 9.4285
cc 3
eloc 9
nc 4
nop 5
1
<?php
2
3
class CommentsGridField extends GridField
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
     * {@inheritdoc}
7
     */
8
    protected function newRow($total, $index, $record, $attributes, $content)
9
    {
10
        if (!isset($attributes['class'])) {
11
            $attributes['class'] = '';
12
        }
13
14
        if ($record->IsSpam) {
15
            $attributes['class'] .= ' spam';
16
        }
17
18
        return FormField::create_tag(
19
            'tr',
20
            $attributes,
21
            $content
22
        );
23
    }
24
}
25