TagFieldTestController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 7
c 1
b 0
f 0
dl 0
loc 18
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A TagFieldTestForm() 0 11 1
A TagFieldTestFormSubmit() 0 3 1
1
<?php
2
3
namespace SilverStripe\TagField\Tests\Stub;
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\FormAction;
10
use SilverStripe\ORM\DataList;
11
use SilverStripe\ORM\DataObject;
12
use SilverStripe\TagField\TagField;
13
14
class TagFieldTestController extends Controller implements TestOnly
15
{
16
    public function TagFieldTestForm()
17
    {
18
        $fields = new FieldList(
19
            $tagField = new TagField('Tags', '', new DataList('TagFieldTestBlogTag'))
20
        );
21
22
        $actions = new FieldList(
23
            new FormAction('TagFieldTestFormSubmit')
24
        );
25
26
        return new Form($this, 'TagFieldTestForm', $fields, $actions);
27
    }
28
29
    public function TagFieldTestFormSubmit(DataObject $dataObject, Form $form)
30
    {
31
        $form->saveInto($dataObject);
32
    }
33
}
34