Passed
Push — master ( 1155ca...3f5943 )
by Damian
08:13
created

MyActionMenuItemComponent::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace SilverStripe\Forms\Tests\GridField\GridFieldConfigTest;
4
5
use SilverStripe\Dev\TestOnly;
6
use SilverStripe\Forms\GridField\GridField_ActionMenuItem;
7
use SilverStripe\Forms\GridField\GridFieldEditButton;
8
9
class MyActionMenuItemComponent extends GridFieldEditButton implements TestOnly
10
{
11
    protected $shouldDisplay;
12
13
    public function __construct($shouldDisplay = true)
14
    {
15
        $this->shouldDisplay = $shouldDisplay;
16
    }
17
18
    public function getGroup($gridField, $record, $columnName)
19
    {
20
        return $this->shouldDisplay ? GridField_ActionMenuItem::DEFAULT_GROUP : null;
21
    }
22
}
23