Completed
Push — master ( 3cca5d...b02bf5 )
by Robbie
10s
created

GenerateCSVJobTestController::Form()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
3
namespace SilverStripe\GridFieldQueuedExport\Tests;
4
5
use SilverStripe\Control\Controller;
6
use SilverStripe\Dev\TestOnly;
7
use SilverStripe\Forms\FieldList;
8
use SilverStripe\Forms\Form;
9
use SilverStripe\Forms\GridField\GridField;
10
use SilverStripe\Forms\GridField\GridFieldConfig_RecordEditor;
11
use SilverStripe\Forms\GridField\GridFieldExportButton;
12
use SilverStripe\GridfieldQueuedExport\Forms\GridFieldQueuedExportButton;
13
14
class GenerateCSVJobTestController extends Controller implements TestOnly
15
{
16
    private static $allowed_actions = ['Form'];
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by
The property $allowed_actions is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
17
18
    /**
19
     * @return string
20
     */
21
    public function Link($action = null)
22
    {
23
        return 'jobtest/';
24
    }
25
26
    /**
27
     * @return Form
28
     */
29
    public function Form()
30
    {
31
        // Get records
32
        $records = GenerateCSVJobTestRecord::get();
33
34
        // Set config
35
        $config = GridFieldConfig_RecordEditor::create();
36
        $config->removeComponentsByType(GridFieldExportButton::class);
37
        $config->addComponent(new GridFieldQueuedExportButton('buttons-after-left'));
38
        $fields = new GridField('MyGridfield', 'My Records', $records, $config);
39
        /** @skipUpgrade */
40
        return Form::create($this, 'Form', new FieldList($fields), new FieldList());
41
    }
42
}
43