mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-30 13:19:11 +02:00
Fix Test form factories use the new interface
This commit is contained in:
parent
edcb220e4a
commit
17ddfab877
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace SilverStripe\Forms\Tests\FormFactoryTest;
|
namespace SilverStripe\Forms\Tests\FormFactoryTest;
|
||||||
|
|
||||||
use SilverStripe\Control\Controller;
|
use SilverStripe\Control\RequestHandler;
|
||||||
use SilverStripe\Forms\DefaultFormFactory;
|
use SilverStripe\Forms\DefaultFormFactory;
|
||||||
use SilverStripe\Forms\FieldList;
|
use SilverStripe\Forms\FieldList;
|
||||||
use SilverStripe\Forms\FormAction;
|
use SilverStripe\Forms\FormAction;
|
||||||
@ -12,13 +12,13 @@ use SilverStripe\Forms\TextField;
|
|||||||
/**
|
/**
|
||||||
* Test factory
|
* Test factory
|
||||||
*/
|
*/
|
||||||
class EditFactory extends DefaultFormFactory
|
class EditFormFactory extends DefaultFormFactory
|
||||||
{
|
{
|
||||||
private static $extensions = [
|
private static $extensions = [
|
||||||
ControllerExtension::class
|
ControllerExtension::class
|
||||||
];
|
];
|
||||||
|
|
||||||
protected function getFormFields(Controller $controller, $name, $context = [])
|
protected function getFormFields(RequestHandler $controller = null, $name, $context = [])
|
||||||
{
|
{
|
||||||
$fields = new FieldList(
|
$fields = new FieldList(
|
||||||
new HiddenField('ID'),
|
new HiddenField('ID'),
|
||||||
@ -28,7 +28,7 @@ class EditFactory extends DefaultFormFactory
|
|||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getFormActions(Controller $controller, $name, $context = [])
|
protected function getFormActions(RequestHandler $controller = null, $name, $context = [])
|
||||||
{
|
{
|
||||||
$actions = new FieldList(
|
$actions = new FieldList(
|
||||||
new FormAction('save', 'Save')
|
new FormAction('save', 'Save')
|
||||||
|
@ -29,7 +29,7 @@ class TestController extends Controller
|
|||||||
{
|
{
|
||||||
// Simple example; Just get the first draft record
|
// Simple example; Just get the first draft record
|
||||||
$record = $this->getRecord();
|
$record = $this->getRecord();
|
||||||
$factory = new EditFactory();
|
$factory = new EditFormFactory();
|
||||||
return $factory->getForm($this, 'Form', ['Record' => $record]);
|
return $factory->getForm($this, 'Form', ['Record' => $record]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user