StringTagFieldTestFormSubmit()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
namespace SilverStripe\TagField\Tests\Stub;
4
5
use SilverStripe\Control\Controller;
6
use SilverStripe\ORM\DataObject;
7
use SilverStripe\Dev\TestOnly;
8
use SilverStripe\Forms\FieldList;
9
use SilverStripe\Forms\Form;
10
use SilverStripe\Forms\FormAction;
11
use SilverStripe\TagField\StringTagField;
12
13
class StringTagFieldTestController extends Controller implements TestOnly
14
{
15
    public function StringTagFieldTestForm()
16
    {
17
        $fields = new FieldList(
18
            $tagField = new StringTagField('Tags')
19
        );
20
21
        $actions = new FieldList(
22
            new FormAction('StringTagFieldTestFormSubmit')
23
        );
24
25
        return new Form($this, 'StringTagFieldTestForm', $fields, $actions);
26
    }
27
28
    public function StringTagFieldTestFormSubmit(DataObject $dataObject, Form $form)
29
    {
30
        $form->saveInto($dataObject);
31
    }
32
}
33