mirror of
https://github.com/silverstripe/silverstripe-tagfield
synced 2024-10-22 11:05:32 +02:00
34 lines
879 B
PHP
34 lines
879 B
PHP
|
<?php
|
||
|
|
||
|
namespace SilverStripe\TagField\Tests\Stub;
|
||
|
|
||
|
use SilverStripe\Control\Controller;
|
||
|
use SilverStripe\ORM\DataList;
|
||
|
use SilverStripe\ORM\DataObject;
|
||
|
use SilverStripe\Dev\TestOnly;
|
||
|
use SilverStripe\Forms\FieldList;
|
||
|
use SilverStripe\Forms\Form;
|
||
|
use SilverStripe\Forms\FormAction;
|
||
|
use SilverStripe\TagField\StringTagField;
|
||
|
|
||
|
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);
|
||
|
}
|
||
|
}
|