mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
44 lines
1.3 KiB
PHP
44 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace SilverStripe\Forms\Tests\GridField\GridFieldAddExistingAutocompleterTest;
|
|
|
|
use SilverStripe\Control\Controller;
|
|
use SilverStripe\Dev\TestOnly;
|
|
use SilverStripe\Forms\FieldList;
|
|
use SilverStripe\Forms\Form;
|
|
use SilverStripe\Forms\GridField\GridField;
|
|
use SilverStripe\Forms\GridField\GridFieldAddExistingAutocompleter;
|
|
use SilverStripe\Forms\GridField\GridFieldConfig;
|
|
use SilverStripe\Forms\GridField\GridFieldDataColumns;
|
|
use SilverStripe\Forms\Tests\GridField\GridFieldTest\Player;
|
|
|
|
/**
|
|
* @skipUpgrade
|
|
*/
|
|
class TestController extends Controller implements TestOnly
|
|
{
|
|
|
|
private static $allowed_actions = array('Form');
|
|
|
|
protected $template = 'BlankPage';
|
|
|
|
public function Link($action = null)
|
|
{
|
|
return Controller::join_links('GridFieldAddExistingAutocompleterTest_Controller', $action, '/');
|
|
}
|
|
|
|
public function Form()
|
|
{
|
|
/**
|
|
* @var Player $player
|
|
*/
|
|
$player = Player::get()->find('Email', 'player1@test.com');
|
|
$config = GridFieldConfig::create()->addComponents(
|
|
$relationComponent = new GridFieldAddExistingAutocompleter('before'),
|
|
new GridFieldDataColumns()
|
|
);
|
|
$field = new GridField('testfield', 'testfield', $player->Teams(), $config);
|
|
return new Form($this, 'Form', new FieldList($field), new FieldList());
|
|
}
|
|
}
|