2016-10-14 03:30:05 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\Forms\Tests\GridField\GridField_URLHandlerTest;
|
|
|
|
|
|
|
|
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\GridFieldConfig;
|
|
|
|
use SilverStripe\ORM\ArrayList;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @skipUpgrade
|
|
|
|
*/
|
|
|
|
class TestController extends Controller implements TestOnly
|
|
|
|
{
|
2017-06-22 12:50:45 +02:00
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
if (Controller::has_curr()) {
|
|
|
|
$this->setRequest(Controller::curr()->getRequest());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
public function Link($action = null)
|
|
|
|
{
|
|
|
|
return Controller::join_links('GridField_URLHandlerTest_Controller', $action, '/');
|
|
|
|
}
|
2016-10-14 03:30:05 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
private static $allowed_actions = array('Form');
|
2016-10-14 03:30:05 +02:00
|
|
|
|
2017-03-02 03:24:38 +01:00
|
|
|
/**
|
|
|
|
* @skipUpgrade
|
|
|
|
* @return Form
|
|
|
|
*/
|
2016-12-16 05:34:21 +01:00
|
|
|
public function Form()
|
|
|
|
{
|
|
|
|
$gridConfig = GridFieldConfig::create();
|
|
|
|
$gridConfig->addComponent(new TestComponent());
|
2016-10-14 03:30:05 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
$gridData = new ArrayList();
|
|
|
|
$gridField = new GridField('Grid', 'My grid', $gridData, $gridConfig);
|
2016-10-14 03:30:05 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
return new Form(
|
|
|
|
$this,
|
|
|
|
'Form',
|
|
|
|
new FieldList(
|
|
|
|
$gridField
|
|
|
|
),
|
|
|
|
new FieldList()
|
|
|
|
);
|
|
|
|
}
|
2016-10-14 03:30:05 +02:00
|
|
|
}
|