2016-10-20 12:42:24 +13:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\Forms;
|
|
|
|
|
|
|
|
use SilverStripe\Control\Controller;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A service which can generate a form
|
|
|
|
*/
|
2016-11-29 12:31:16 +13:00
|
|
|
interface FormFactory
|
|
|
|
{
|
2016-10-20 12:42:24 +13:00
|
|
|
|
2016-11-29 12:31:16 +13:00
|
|
|
/**
|
|
|
|
* Default form name.
|
|
|
|
*/
|
|
|
|
const DEFAULT_NAME = 'Form';
|
2016-10-20 12:42:24 +13:00
|
|
|
|
2016-11-29 12:31:16 +13: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 12:42:24 +13:00
|
|
|
|
2016-11-29 12:31:16 +13:00
|
|
|
/**
|
|
|
|
* Return list of mandatory context keys
|
|
|
|
*
|
2016-12-12 15:25:18 +13:00
|
|
|
* @return array
|
2016-11-29 12:31:16 +13:00
|
|
|
*/
|
|
|
|
public function getRequiredContext();
|
2016-10-20 12:42:24 +13:00
|
|
|
}
|