mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-06 09:41:36 +02:00
40 lines
1.1 KiB
PHP
40 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace SilverStripe\Forms\Tests\FormFactoryTest;
|
|
|
|
use SilverStripe\Control\RequestHandler;
|
|
use SilverStripe\Forms\DefaultFormFactory;
|
|
use SilverStripe\Forms\FieldList;
|
|
use SilverStripe\Forms\FormAction;
|
|
use SilverStripe\Forms\HiddenField;
|
|
use SilverStripe\Forms\TextField;
|
|
|
|
/**
|
|
* Test factory
|
|
*/
|
|
class EditFormFactory extends DefaultFormFactory
|
|
{
|
|
private static $extensions = [
|
|
ControllerExtension::class
|
|
];
|
|
|
|
protected function getFormFields(RequestHandler $controller = null, $name, $context = [])
|
|
{
|
|
$fields = new FieldList(
|
|
new HiddenField('ID'),
|
|
new TextField('Title')
|
|
);
|
|
$this->invokeWithExtensions('updateFormFields', $fields, $controller, $name, $context);
|
|
return $fields;
|
|
}
|
|
|
|
protected function getFormActions(RequestHandler $controller = null, $name, $context = [])
|
|
{
|
|
$actions = new FieldList(
|
|
new FormAction('save', 'Save')
|
|
);
|
|
$this->invokeWithExtensions('updateFormActions', $actions, $controller, $name, $context);
|
|
return $actions;
|
|
}
|
|
}
|