Completed
Pull Request — master (#196)
by Robbie
13:10
created

CommentsGridField   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 22
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A newRow() 0 16 3
1
<?php
2
3
namespace SilverStripe\Comments\Admin;
4
5
use SilverStripe\Forms\FormField;
6
use SilverStripe\Forms\GridField\GridField;
7
8
class CommentsGridField extends GridField
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    protected function newRow($total, $index, $record, $attributes, $content)
14
    {
15
        if (!isset($attributes['class'])) {
16
            $attributes['class'] = '';
17
        }
18
19
        if ($record->IsSpam) {
20
            $attributes['class'] .= ' spam';
21
        }
22
23
        return FormField::create_tag(
24
            'tr',
25
            $attributes,
26
            $content
27
        );
28
    }
29
}
30