2016-10-20 01:42:24 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\Forms;
|
|
|
|
|
|
|
|
use SilverStripe\Control\Controller;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
* @param Controller $controller Parent controller
|
|
|
|
* @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
|
|
|
|
*/
|
|
|
|
public function getForm(Controller $controller, $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
|
|
|
}
|