silverstripe-framework/src/Forms/FormFactory.php

37 lines
807 B
PHP
Raw Normal View History

<?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-11-29 00:31:16 +01:00
/**
* Default form name.
*/
const DEFAULT_NAME = 'Form';
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-11-29 00:31:16 +01:00
/**
* Return list of mandatory context keys
*
* @return array
2016-11-29 00:31:16 +01:00
*/
public function getRequiredContext();
}