Completed
Pull Request — master (#71)
by John
02:26
created

ElementalGridFieldDeleteAction   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 3
dl 0
loc 20
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getColumnContent() 0 17 4
1
<?php
2
3
/**
4
 * @package elemental
5
 */
6
class ElementalGridFieldDeleteAction extends GridFieldDeleteAction {
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...
7
8
    public function getColumnContent($gridField, $record, $columnName) {
9
        if(!$record->canDelete()) return;
10
11
        if($record->canDelete() && $record->VirtualClones()->count() == 0) {
12
            $field = GridField_FormAction::create($gridField,
13
                    'DeleteRecord'.$record->ID,
14
                    false,
15
                    'deleterecord',
16
                    array('RecordID' => $record->ID)
17
                )
18
                ->addExtraClass('gridfield-button-delete')
19
                ->setAttribute('title', _t('GridAction.Delete', 'Delete'))
20
                ->setAttribute('data-icon', 'cross-circle')
21
                ->setDescription(_t('GridAction.DELETE_DESCRIPTION','Delete'));
22
            return $field->Field();
23
        }
24
    }
25
}
26