2017-06-22 07:15:17 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\TagField\Tests\Stub;
|
|
|
|
|
|
|
|
use SilverStripe\Control\Controller;
|
|
|
|
use SilverStripe\Dev\TestOnly;
|
|
|
|
use SilverStripe\Forms\FieldList;
|
|
|
|
use SilverStripe\Forms\Form;
|
|
|
|
use SilverStripe\Forms\FormAction;
|
2018-11-16 10:29:49 +01:00
|
|
|
use SilverStripe\ORM\DataList;
|
|
|
|
use SilverStripe\ORM\DataObject;
|
|
|
|
use SilverStripe\TagField\TagField;
|
2017-06-22 07:15:17 +02:00
|
|
|
|
|
|
|
class TagFieldTestController extends Controller implements TestOnly
|
|
|
|
{
|
|
|
|
public function TagFieldTestForm()
|
|
|
|
{
|
|
|
|
$fields = new FieldList(
|
|
|
|
$tagField = new TagField('Tags', '', new DataList('TagFieldTestBlogTag'))
|
|
|
|
);
|
|
|
|
|
|
|
|
$actions = new FieldList(
|
|
|
|
new FormAction('TagFieldTestFormSubmit')
|
|
|
|
);
|
|
|
|
|
|
|
|
return new Form($this, 'TagFieldTestForm', $fields, $actions);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function TagFieldTestFormSubmit(DataObject $dataObject, Form $form)
|
|
|
|
{
|
|
|
|
$form->saveInto($dataObject);
|
|
|
|
}
|
|
|
|
}
|