Test_GridFieldAction::getButtonLabel()   A
last analyzed

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 3
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace LeKoala\CmsActions\Test;
4
5
use SilverStripe\Dev\TestOnly;
6
use LeKoala\CmsActions\GridFieldRowButton;
7
use SilverStripe\Forms\GridField\GridField;
8
9
/**
10
 * A test action
11
 */
12
class Test_GridFieldAction extends GridFieldRowButton implements TestOnly
13
{
14
    protected $fontIcon = 'torso';
15
    public $performedActionName;
16
    public $performedArguments;
17
    public $performedData;
18
19
    public function getActionName()
20
    {
21
        return 'test';
22
    }
23
24
    public function getButtonLabel(GridField $gridField, $record, $columnName)
25
    {
26
        return 'Do Test';
27
    }
28
29
    /**
30
     * Handle the actions and apply any changes to the GridField
31
     *
32
     * @param GridField $gridField
33
     * @param string $actionName
34
     * @param mixed $arguments
35
     * @param array $data - form data
36
     * @return void
37
     */
38
    public function doHandle(GridField $gridField, $actionName, $arguments, $data)
39
    {
40
        $this->performedActionName = $actionName;
41
        $this->performedArguments = $arguments;
42
        $this->performedData = $data;
43
    }
44
}
45