2016-10-20 01:42:24 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\Forms;
|
|
|
|
|
2017-05-04 04:07:51 +02:00
|
|
|
use SilverStripe\Control\RequestHandler;
|
2016-10-20 01:42:24 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A service which can generate a form
|
|
|
|
*/
|
2016-11-29 00:31:16 +01:00
|
|
|
interface FormFactory
|
|
|
|
{
|
2016-10-20 01:42:24 +02:00
|
|
|
|
2016-11-29 00:31:16 +01:00
|
|
|
/**
|
|
|
|
* Default form name.
|
|
|
|
*/
|
|
|
|
const DEFAULT_NAME = 'Form';
|
2016-10-20 01:42:24 +02:00
|
|
|
|
2016-11-29 00:31:16 +01:00
|
|
|
/**
|
|
|
|
* Generates the form
|
|
|
|
*
|
2017-05-04 04:07:51 +02:00
|
|
|
* @param RequestHandler $controller Parent controller
|
2016-11-29 00:31:16 +01:00
|
|
|
* @param string $name
|
|
|
|
* @param array $context List of properties which may influence form scaffolding.
|
|
|
|
* E.g. 'Record' if building a form for a record.
|
|
|
|
* Custom factories may support more advanced parameters.
|
|
|
|
* @return Form
|
|
|
|
*/
|
2017-05-04 04:07:51 +02:00
|
|
|
public function getForm(RequestHandler $controller = null, $name = self::DEFAULT_NAME, $context = []);
|
2016-10-20 01:42:24 +02:00
|
|
|
|
2016-11-29 00:31:16 +01:00
|
|
|
/**
|
|
|
|
* Return list of mandatory context keys
|
|
|
|
*
|
2016-12-12 03:25:18 +01:00
|
|
|
* @return array
|
2016-11-29 00:31:16 +01:00
|
|
|
*/
|
|
|
|
public function getRequiredContext();
|
2016-10-20 01:42:24 +02:00
|
|
|
}
|